Home
Analytics
PDF/A in BIRT 2.6.2
EkkeW
<p>Hello, </p>
<p> </p>
<p>I need pdf in PDF/A format with BIRT 2.6.2. I have tried a lot but can not manage it (the jar file should be jar signed, the actual Eclipse for Report uses 4.1, patching the jar file without signing it will cause an "The output format pdf is not supported." error)...</p>
<p> </p>
<p>Is there a version for the the pdf emitter with PDF/A output format or how can I build it without rebuild the whole BIRT version.</p>
<p> </p>
<p> </p>
Find more posts tagged with
Comments
mwilliams
<p>You could create a new PDF emitter plugin for BIRT. That or changing the source of the current one are probably your only ways to get it working for the older version.</p>
<p> </p>
<p>There is a bug reported for this from a few years ago that you could comment on to try to get it in a later version.</p>
<p> </p>
<p><a data-ipb='nomediaparse' href='
https://bugs.eclipse.org/bugs/show_bug.cgi?id=362282'>https://bugs.eclipse.org/bugs/show_bug.cgi?id=362282</a></p>
;
EkkeW
<p>Is it not possible to get a Jar file <br>
org.eclipse.birt.report.engine.emitter.pdf_2.6.2.r262_v20110127_pdfa</p>
<p>which is the same as the </p>
<p> org.eclipse.birt.report.engine.emitter.pdf_2.6.2.r262_v20110127</p>
<p>but uses the calls which are in the bug described?</p>
<p> </p>
<p>Is it very very difficult to compile the whole birt framework which got only there lines of code for PDF/A.</p>
mwilliams
<p>That would be the option of creating a new plugin for BIRT 2.6.2. You could use the existing PDF emitter code in your new plugin. You'd just modify the name of the emitter to be pdfa or something like that vs the existing emitter named pdf. Or delete the current emitter and replace it with your new emitter.</p>
EkkeW
<p>Sorry for the delayed response:</p>
<p> </p>
<p>I have build pdf/a emitter based on the pdf emitter of BIRT and there is still an error I can not fix.</p>
<p> </p>
<p>When using the default emitter with </p>
<p> PDFRenderOption options = new PDFRenderOption();</p>
<div> options.setOutputFormat(IRenderOption.OUTPUT_FORMAT_PDF);</div>
<div>everything is fine.</div>
<div> </div>
<div>But when I will use my code with</div>
<p> PDFRenderOption options = new PDFRenderOption();</p>
<div> options.setOption(IRenderOption.OUTPUT_EMITTERID_PDF, "org.eclipse.birt.report.engine.emitter.pdfa");</div>
<div>there will be only a message:</div>
<div> java.lang.RuntimeException: java.io.IOException: PDF header signature not found.</div>
<div> </div>
<div>In the emitter I have changed only this lines:</div>
<div> // writer.setFullCompression();</div>
<div> // writer.setRgbTransparencyBlending(true);</div>
<div> writer.setPdfVersion(PdfWriter.PDF_VERSION_1_2);</div>
<div> writer.setPDFXConformance(PdfWriter.PDFA1B);</div>
<div>This is the example of the bug. </div>
<div> </div>
<div>I am not sure if I must sign a PDF/A1B so the code example is not complete ?<br>
</div>
mwilliams
<p>A quick Google search revealed lots of stackoverflow posts about this error from iText with many different causes. You might take a look through some of those to see if any help. If you attach your plugin project, I could take a closer look and do some testing of my own.</p>
EkkeW
<p>I have checked the code and found out that the format of the report was HTML so this can not be add to ad PDF. <br><br>
But I am still not able to use the jar for pdf/a which I have build. My jar is named org.eclipse.birt.report.engine.emitter.pdfa and in the code I use a switch:<br>
​ PDFRenderOption options = new PDFRenderOption();</p>
<div> if (!true) {</div>
<div> options.setOutputFormat(IRenderOption.OUTPUT_FORMAT_PDF);</div>
<div> } else {</div>
<div> options.setOutputFormat(IRenderOption.OUTPUT_FORMAT_PDF);</div>
<div> options.setOption(IRenderOption.OUTPUT_EMITTERID_PDF, "org.eclipse.birt.report.engine.emitter.pdfa");</div>
<div> options.setEmitterID("org.eclipse.birt.report.engine.emitter.pdfa");</div>
<div> }</div>
<div> </div>
<div>The standard output PDF will work but the options will not. There is an error <br>
org.eclipse.birt.report.engine.api.EngineException: EmitterID org.eclipse.birt.report.engine.emitter.pdfa for render option is invalid</div>
<div> </div>
<div>Can you please help me I can not find information how to use two emitters?<br><br>
Thank you</div>
EkkeW
<p>I have tried for four hours to fix it and I do not know what's wrong. </p>
<p> </p>
<p>All things I found in a internet search I have checked and setting logging level to fine only get an </p>
<p><span style="color:rgb(76,47,45);font-family:Courier;font-size:12px;background-color:rgb(223,219,196);">02.02.2015 13:24:57 org.eclipse.birt.report.engine.api.impl.EngineTask setupRenderOption</span></p>
<p style="font-size:12px;font-family:Courier;color:rgb(76,47,45);background-color:rgb(223,219,196);">SCHWERWIEGEND: Error.OutputFormatNotSupported</p>
<p> </p>
<p>Can you please take a look at the code?</p>
<p> </p>
<p>The jar file is copied in the WEB-INF/platform/plugins directory of the project. </p>
mwilliams
<p>Can you send me your new emitter so I do some testing myself? My guess is there's at least a problem with the way you're using the PDF Render Options with the modified emitter, but I don't know for sure. Including the code for your modified emitter would be nice as well.</p>
EkkeW
<p>I have send the code to the email ... did you receive my email? </p>
mwilliams
<p>What email address did you send it to and when?</p>
EkkeW
<p>I sent to mwilliams.actuate@gmail.com .... I will resend it.</p>
mwilliams
<p>Found them. They were filtered into my junk mail. I'll try to start looking at this, this afternoon.
</p>
mwilliams
Looking at what you sent me, if you create a new plugin for pdfa, you'll need to also create the emitter config plugin.
EkkeW
<p>I am sorry but I do not understand the "emitter config plugin" ... I have tried to find examples but all I found looks similar to my code. <br><br>
Can you please explain it? Or must I change the</p>
<p>org.eclipse.birt.report.engine.emitter.pdf.config_2.6.2.r262_v20110127</p>
<p> </p>
<p>I thought that pdfa takes all settings of pdf and only the iText Option for PDFA must be set?</p>
mwilliams
If you look at the plug-ins for the emitters, they all have a config jar, too. Maybe it's not required, but given that the pdf emitter has a config jar, I think it would make sense to create one of them for your modified emitter as well.<br><br>Attached is a "PDFA" emitter plugin and emitter config plugin. I made no modifications to the plugin besides all the naming to make it pdfa, so this is still the pdf plugin named pdfa. You should be able to put this in your dropins folder and use it alongside the original pdf emitter.
EkkeW
<p>There is a problem in </p>
<p>Error happened while running the report.</p>
<div>java.lang.LinkageError: loader constraint violation: when resolving method "org.eclipse.birt.report.engine.i18n.EngineResourceHandle.<init>(Lcom/ibm/icu/util/ULocale;)V" the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the current class, org/eclipse/birt/report/engine/emitter/pdfa/PDFAPageDevice, and the class loader (instance of com/sun/enterprise/loader/EJBClassLoader) for resolved class, org/eclipse/birt/report/engine/i18n/EngineResourceHandle, have different Class objects for the type com/ibm/icu/util/ULocale used in the signature</div>
<div> </div>
<div>Can you send me the source so I can compile it on my environment?</div>
mwilliams
I sent you the source in email.
EkkeW
<p>I have tried to get it run but even with your source I am not able to create a pdf/a.</p>
<p> </p>
<p>I have send you an email with my code and a description (4th March). The customer (a big automotive producer) has to archive the pdf for 30 years and we need a pdf/a</p>
<p> </p>
<p>Can you please help me to get it run ... it is an essential feature and I think it is important for other applications at the customer too.</p>
<p> </p>
<p>Thank you again.</p>
mwilliams
I didn't actually create a PDFA emitter. I just made the changes to the existing PDF emitter to get it to show as PDFA as an optional output format. You'd still have to change the code to create an actual PDFA output. Do you know that the source code that you had emailed me will definitely make a PDFA file?
EkkeW
<p>Should I replace the pdf emitter and the emitter config code and use only one PDF format (the PDF/A). In my code I have tried to use a</p>
<p> </p>
<p> options.setOption(IRenderOption.OUTPUT_EMITTERID_PDF, "org.eclipse.birt.report.engine.emitter.pdfa");</p>
<div> </div>
<div>because I thing that this should use the emitter. </div>
<div> </div>
<div>Is it not possible to include a new emitter and use it this way? If I should use only one emitter I will not understand the emitter id in </div>
<div> id="org.eclipse.birt.report.engine.emitter.pdfa"</div>
<div>in the plugin.xml </div>
<div> <emitter</div>
<div> class="org.eclipse.birt.report.engine.emitter.pdfa.PDFAEmitter"</div>
<div> format="pdfa"</div>
<div> pagination="paper-size-pagination"</div>
<div> id="org.eclipse.birt.report.engine.emitter.pdfa"</div>
<div> mimeType="application/pdf"</div>
<div> supportedImageFormats="PNG;GIF;JPG;BMP;SVG" /></div>
<div> </div>
<div>I thought that with this I can both the pdf and die pdf/a emitter.</div>
<div> </div>
<div>For this: Should I use only one pdf emitter?</div>
mwilliams
If you create the pdfa emitter to be pdf, just like the old case with the out-of-the-box xls emitter and the Tirbix xls emitter where you could specify the id, then, it should work, yes. The way I edited it was to have a separate option for PDF/A that would show as a separate option from your run menu. This way would have you just specify the format as pdfa and it should use the appropriate emitter.<br><br>See this post discussing the use of the emitter id with xls vs Tribix xls:<br><br><a data-ipb='nomediaparse' href='
http://birtworld.blogspot.com/2011/07/replacing-default-birt-xls-emitter.html'>http://birtworld.blogspot.com/2011/07/replacing-default-birt-xls-emitter.html</a>
;
EkkeW
<div>Change </div>
<div> options.setOutputFormat(IRenderOption.OUTPUT_FORMAT_PDF);</div>
<div>to </div>
<div> options.setOutputFormat("pdfa");</div>
<div> </div>
<div>There is an error </div>
<div>java.lang.RuntimeException: java.lang.RuntimeException: org.eclipse.birt.report.engine.api.UnsupportedFormatException: The output format pdfa is not supported.</div>
<div> </div>
<div> </div>
<div>Change</div>
<div> options.setOutputFormat(IRenderOption.OUTPUT_FORMAT_PDF);</div>
<div>to</div>
<div> options.setOutputFormat("pdf");</div>
<div> options.setOption(IRenderOption.EMITTER_ID, "org.eclipse.birt.report.engine.emitter.pdfa");</div>
<div> </div>
<div>There is an error</div>
<div>java.lang.RuntimeException: java.lang.RuntimeException: org.eclipse.birt.report.engine.api.EngineException: EmitterID org.eclipse.birt.report.engine.emitter.pdfa for render option is invalid.</div>
<div> </div>
<div>The PDF/A Jar files are in the same directory as the PDF Jar files. There is no other error message ... I hope that I do not miss an import thing - but I definitely do not know what is wrong.<br><br>
I think I should stop this Sisyphean task for you & me and wait until PDF/A is in the standard birt installation. <br><br>
Mea culpa if I am wrong ... but right know I am frustrated.</div>
<p> </p>
mwilliams
Do you know for a fact that the code you have will create a proper pdfa output? If so, I can copy the code changes into the emitter I created that works separately as a PDFA option in the designer and rebuild it to see if it works.
EkkeW
<p>Sorry I have not understand your question "<span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">Do you know for a fact that the code you have will create a proper pdfa output?"</span></p>
<p> </p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">Now I understand and I can refer to this topic</span></p>
<p> </p>
<p><a data-ipb='nomediaparse' href='
https://www.eclipse.org/forums/index.php/t/259539/'>https://www.eclipse.org/forums/index.php/t/259539/</a></p>
;
<p> </p>
<p>The code </p>
<p><span style="color:rgb(0,0,0);font-family:'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;background-color:rgb(244,244,244);"> PdfWriter writer = PdfWriter.getInstance(document,</span></p>
<p><span style="color:rgb(0,0,0);font-family:'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;background-color:rgb(244,244,244);"> new FileOutputStream(filename));</span><br><span style="color:rgb(0,0,0);font-family:'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;background-color:rgb(244,244,244);"> writer.setPdfVersion(PdfWriter.PDF_VERSION_1_4);</span><br><span style="color:rgb(0,0,0);font-family:'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;background-color:rgb(244,244,244);"> writer.setPDFXConformance(PdfWriter.PDFA1B)</span></p>
<p> </p>
<p>should create a pdf as long as it is using the com.​lowagie.​text.​pdf.​PdfWriter class.</p>
<p> </p>
<p>BTW: Thank you for your endurance ... yesterday it was no good "try & error" day </p>
EkkeW
<p>Can you please give me a feedback on the topic? I have sent an email too and no reply.</p>
<p> </p>
<p>Thank you</p>
mwilliams
Sorry for the delay. I'll take a look at the source and see about adding these lines and running the emitter to see what happens.
mwilliams
This is the emitter with your two lines of code added in the two places where there is a writer.getInstance call made.<br><br>Let me know if it works for you. It successfully outputs a file for me. Just not sure if it's what you're looking for.<br><br>Put these in your "dropins" folder and restart eclipse.
EkkeW
<p>There is an error .... but I think the jar file is found and will be used. I will try later today to check my sources with your jar files - maybe there is a mistake in my xml config files. With this I will create new jar files.</p>
<p> </p>
<p><span style="color:rgb(76,47,45);font-family:Courier;font-size:12px;background-color:rgb(223,219,196);">06.05.2015 07:44:15 org.eclipse.birt.report.engine.api.impl.RunAndRenderTask doRun</span></p>
<p style="font-size:12px;font-family:Courier;color:rgb(76,47,45);background-color:rgb(223,219,196);">SCHWERWIEGEND: Error happened while running the report.</p>
<p style="font-size:12px;font-family:Courier;color:rgb(76,47,45);background-color:rgb(223,219,196);">java.lang.LinkageError: loader constraint violation: when resolving method "org.eclipse.birt.report.engine.i18n.EngineResourceHandle.<init>(Lcom/ibm/icu/util/ULocale;)V" the class loader (instance of org/eclipse</p>
<p style="font-size:12px;font-family:Courier;color:rgb(76,47,45);background-color:rgb(223,219,196);">/osgi/internal/baseadaptor/DefaultClassLoader) of the current class, org/eclipse/birt/report/engine/emitter/pdfa/PDFAPageDevice, and the class loader (instance of com/sun/enterprise/loader/EJBClassLoader) for re</p>
<p style="font-size:12px;font-family:Courier;color:rgb(76,47,45);background-color:rgb(223,219,196);">solved class, org/eclipse/birt/report/engine/i18n/EngineResourceHandle, have different Class objects for the type com/ibm/icu/util/ULocale used in the signature</p>
<p style="font-size:12px;font-family:Courier;color:rgb(76,47,45);background-color:rgb(223,219,196);"> at org.eclipse.birt.report.engine.emitter.pdfa.PDFAPageDevice.<init>(PDFAPageDevice.java:89)</p>
<p style="font-size:12px;font-family:Courier;color:rgb(76,47,45);background-color:rgb(223,219,196);"> at org.eclipse.birt.report.engine.emitter.pdfa.PDFARender.createPageDevice(PDFARender.java:66)</p>
mwilliams
I was able to use the emitter plugin I attached above without any issues, from the designer. Are you having an issue with the jars I attached or with your own that you've made? Let me know.
Jozef
<p>I was able to build a similar custom PDFA emitter plugin for Birt 4.4.2.</p>