PDF / web viewer PDF export differences

ALyons
edited February 11, 2022 in Analytics #1
<p>Hi, After Microsoft decided to break the BIRT web viewer with IE 11 we decided to implement a render to PDF option that opens in a SWT browser window. Since then we have worked out a fix for the web viewer under IE 11 involving plugins and magic, its not always successful however :|.</p><p> </p><p>Having implemented it we have noticed that there are a number of differences in output between the web viewer exported PDF and rending it directly to PDF:</p><p> </p><p>1) Table of contents is not written to the PDF. The web viewer table of contents will export along with the PDF, but when I go straight to PDF there is no table of contents.</p><p>2) Line breaks aren't preserved in text objects when going directly to PDF, when exporting from web viewer they are preserved.</p><p>3) Certain currency symbols won't appear in the direct to PDF method, they will appear when exported from the web viewer.</p><p> </p><p>There are obviously differences in the two processes (programatically and UI), I've tried running the direct to PDF job using as both a IRunAndRenderTask, and as separate run and render tasks. I've searched for options to configure, I've browsed the source code I can't seem to find any kind of option that would account for the TOC being missing or the other behaviors.</p><p> </p><p>Obviously there's something done when first viewing the report in the web viewer that causes these differences. Another frustrating part is that I can even see the TOC entries via renderTask.getTOCTree() output to the console however the emitter isn't including any of it within the final PDF.</p><p> </p><p>Has anyone got any information that can help me isolate and replicate the differences between the two processes?</p>

Comments

  • <p>Can you attach a design and a Java class or at least a design that I can run using Java and the viewer that shows all of your issues?</p>
    Warning No formatter is installed for the format ipb
  • <p>Heh, found out what was causing it :)</p><p> </p><p> </p><p>I started creating an example design/code to show the situation with the intention of using the standalone designer as the basis. However when I ran the preview in PDF method it had the table of contents. So I went and grabbed the designer 4.2.2 source code to see what it was doing to run the report, unfortunately it looked like every other example I'd seen.</p><p> </p><p> </p><p>So i start making a standalone app running my version of the PDF creation code and as I'm transferring the lines I realized that none of the examples included anything like this:</p><pre class="_prettyXprint _lang-js">options.setOutputStream(baos = new ByteArrayOutputStream()); renderTask.setRenderOption(options);renderTask.render();copyFields = new PdfCopyFields(out = new FileOutputStream(filepath));copyFields.addDocument(new PdfReader(baos.toByteArray()));</pre><p>I originally added the PdfCopyFields stuff because PDF's were coming out corrupted for some reason, I found a post on the internet somewhere (can't find it now) suggesting this would fix it and I added it.</p><p> </p><p> </p><p>So I removed the PdfCopyFields and gave it a test, sure enough the PDF is readable and has a table of contents. Obviously the PdfCopyFields is stripping the table of contents from the PDF when writing to file.</p><p> </p><p> </p><p>So while that's solved the line break issue remains, I found this post <a data-ipb='nomediaparse' href='http://www.eclipse.org/forums/index.php/t/34543/'>http://www.eclipse.org/forums/index.php/t/34543/</a&gt; that seems to be describing the same problem. However it seems that by exporting from the web viewer the problem doesn't occur. </p>
  • The years have passed so far but the issue with the line breaks is still here. There are dozens of solutions for this very thing through this forum and many others as well, but I found out myself that the longest of them is actually working best. So, all you can do here is to fix the things manually with the edition tool what you have, I use this one for such purposes https://pump-it-up-job-form.pdffiller.com/ There's also some number of free ones but they're more annotation tools and don't fit for this thing