birt icon indicating copy to clipboard operation
birt copied to clipboard

Page Numbering Breaks While Dynamically Inserting HTML On PDF

Open Beaconsilver opened this issue 1 year ago • 1 comments

Auto text number and report parameter page numbering breaks if an html block is inserted dynamically

Currently using page numbering as a way to handle duplex printing. I generate a few hundred pages at a time. Duplex printing is a way to save some tree's in the process.

I do this by checking if the number of pages and the report can be divided by 2 and adding a blank page when needed - allowing duplex printing without mixing up the pages.

Now i have noticed that when the content of an html block is inserted at runtime from a database - if the block causes the page to overflow to the second page - the page numbering on PDF does not pick this up / breaking the duplex printing

This is only on PDF - generating the report and exporting to html keeps the numbering intact

Beaconsilver avatar Mar 07 '24 10:03 Beaconsilver

Usually the PDF generation is done in a single RunAndRenderTask instead of separate RunTask and RenderTask. In this case, the report cannot know the current page number and the total page number. Maybe you can solve this in a different way, depending on how you integrated BIRT into your application. BIRT includes OpenPDF. If you find a chance to process your PDF after BIRT has generated it but before delivering it to the client or printer, you could write a little routine that obtains the number of pages from the PDF and, if it is odd, appends a blank page.

hvbtup avatar Mar 07 '24 13:03 hvbtup

@Beaconsilver, can you help me reproduce this? I tried generating enough HTML in javascript to overflow the page but it doesn't mess up the page numbering. I generated the HTML in a Text control in <VALUE_OF format="HTML"> and I included an AutoText Page n of m in the footer. I generated the PDF from the designer. Using BIRT 4.14.

SteveSchafer-Innovent avatar Mar 26 '24 20:03 SteveSchafer-Innovent

Closing because of no activity.

wimjongman avatar Jun 27 '24 08:06 wimjongman