简体   繁体   中英

Birt eclipse duplex printing

I've been searching for an answer to this question. How can I print duplex or create double-sided PDF using BIRT + eclipse? I generate documents that contain multiple reports, and often the reports are multi-page. How can I force the header pages to always be "page 1" and avoid the next report from flowing onto the back of the previous report?

This isn't a BIRT topic.

When you say you print from BIRT, that's technically not the case. You create a PDF file with BIRT and print that file somehow.

Unfortunately the PDF file format does not support instructions to do a physical page break at a given logical page break.

So, unless you know at generation time if the resulting file will be printed duplex or not, there is no way to control this.

If you know that the file will be printed duplex in most cases, you might insert blank pages at certain places (maybe with a text "this page is intentionally left blank"), but this results in wasted pages if the file is printed single-sided.

Anyway, this still leaves you with two tasks:

1) Use a different Master Page when a new section of the report starts.

2) Finding out where to insert blank pages.

The first task is actually quite simple. In BIRT, you can have different master pages (say, "first page" and "following page"). You can choose the master page to use in the properties of layout elements in BIRT. Give it a try!

The second task is outside the scope of BIRT, you'll need some kind of PDF post-processing here. The idea is as follows:

Use BIRT to create a PDF file. Use BIRT's TOC entry property to create a PDF TOC (also called Outline). This is the document structure shown on the left side if you open the file in Adobe Reader.

Use a PDF post processor (eg based on iText or whatever) to read the TOC entries. Each entry has information about the page where it points to. Now, if you want to print duplex and the entry starts on a even page (1-based), insert a blank page before this page.

It is possible, but will take at least a few hours of Java programming (or several days, depending on your experience with your chosen PDF processing tool).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM