Good Day

The platform i'm developing for recently switched from PDFBox 2.X to 3.0.0.

I created an add-on which generates a PDF-Documentation of the PBX for 
customers.
This PDF Contains multiple A4-Pages, some in the normail Portrait format, some 
rotated in landscape format for more space.

I use «Template» pages which are single page PDF's. (Cover Sheet.pdf, 
Normal_page.pdf, Normal_page_landscape.pdf), of which i create a copy for every 
page in the main pdf, based on what the user's choice for the documentation is.

In 2.X i used the integrated PDFCloneUtility to create a copy of the Template 
Page(s), and copy it to the main PDF using this:

PDPage SelectedPage = PDFSource.getPage(PageNumber);
              PDFCloneUtility PDC = new PDFCloneUtility(PDFTarget);
              COSDictionary PD = (COSDictionary) 
PDC.cloneForNewDocument(SelectedPage);
              PDPage ClonedPage = new PDPage(PD);
              PDFTarget.addPage(ClonedPage);

But since the PDFCloneUtility is protected in 3.0.0 i switched over to using 
the PDDocument ImportPage Function.

PDPage SelectedPage = PDFSource.getDocument().getPage(PageNumber);
PDPage PDCopiedPage = PDFTarget.importPage(SelectedPage);

Everything seemed fine, when testing. But when i started to generate the full 
documentation, the finished pdf did contain all pages, but adobe throws a lot 
of errors, and all the Landscaped pages are blank.

If i only generate Portrait Pages (Generated_PDF_Portraint_only.pdf), or 
LandScape Pages (Generated_PDF_Landscape_only.pdf) everything is fine, but when 
i mix them (Generated_PDF_Mixed.pdf), the result is broken.

I don't exactly know what could be causing this issue, i was hoping somebody 
might have some kind of clue, where this could come from.
Maybe i'm misunderstanding the importpage function, and that is not actually 
the correct way to clone pages?

Sincerely
Fabian Zünd
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to