While trying to generate PDF that conforms to PDF/A standard using Jasper Reports, I got
net.sf.jasperreports.engine.util.JRPdfaIccProfileNotFoundException.
This is easily fixed by configuring
<property name="net.sf.jasperreports.export.pdfa.icc.profile.path" value="/stuff/myicc.icc"/>
but I need to bundle the icc profile with rest of the WAR just like the fonts the report embeds. How can this be done? I'm looking something like
<property name="net.sf.jasperreports.export.pdfa.icc.profile.path" value="classpath:/jasper/someicc.icc"/>
But this did not work, nor did icc profile relative to the report itself. Can I pass the InputStream as a parameter to the PDFGenerator?
If you are exporting from java code you can use the getClassLoader().getResource() to get the absolute path to file.
Example with JRPdfExporter
JRPdfExporter exporter = new JRPdfExporter();
//... your input and output
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
URL path = this.getClass().getClassLoader().getResource("jasper/someicc.icc");
configuration.setIccProfilePath(path.getFile());
//other settings
exporter.setConfiguration(configuration);
exporter.exportReport();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With