Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #502: Changed constructor for PdfDocument #504

Merged
merged 2 commits into from
Mar 20, 2021

Conversation

VedranSlankovic
Copy link

@VedranSlankovic VedranSlankovic commented Mar 18, 2021

Description of the new Feature/Bugfix

Changed constructor for PdfDocument so it matches constructor from iText library (needed for exporting JasperPrint to PDF/A document).

Related Issue: #502

Unit-Tests for the new Feature/Bugfix

  • Unit-Tests added to reproduce the bug
  • Unit-Tests added to the added feature

Compatibilities Issues

Testing details

Can be tested with jasper reports library.

Example code for converting JasperPrint to PDF/A document:

	public byte[] exportJasperPrintToPDFADocument(JasperPrint print) throws JRException {
		byte[] bytes = null;

		ByteArrayOutputStream stream = new ByteArrayOutputStream();
		JRPdfExporter exporter = new JRPdfExporter();
		exporter.setExporterInput(new SimpleExporterInput(print));
		exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(
				stream));

		SimplePdfExporterConfiguration spec = new SimplePdfExporterConfiguration();
		spec.setPdfaConformance(PdfaConformanceEnum.PDFA_1A);
		spec.setIccProfilePath("eci.icc");
		spec.setMetadataTitle(print.getName());
		exporter.setConfiguration(spec);
		
		exporter.exportReport();
		return stream.toByteArray();
			
	}

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@asturio asturio merged commit 61e540b into LibrePDF:master Mar 20, 2021
@asturio asturio added this to the 1.3.26 milestone May 2, 2021
@asturio asturio linked an issue May 2, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE when exporting JasperPrint to PDF/A document
2 participants