Thanks for the feedback. 

As i have no control over the PDF-Toolbox version i'll have to contact the 
software-developer.
They'll have to update the library that comes with the PBX.

I can deliver my own .jar files with the add-ons but loading both the 3.0.0 and 
3.0.1 JAR file in the same runtime will surely lead to conflicts.

-----Ursprüngliche Nachricht-----
Von: Tilman Hausherr <thaush...@t-online.de> 
Gesendet: Mittwoch, 3. Januar 2024 09:47
An: users@pdfbox.apache.org
Betreff: Re: Importing landscape format and portrait format oriented pages into 
the same PDF causes PDF corruption

Please retry with 3.0.1 and if it still doesn't work, with the current snapshot 
version, because there have been several bugs related to include "foreign" 
pages in PDFs.
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/3.0.2-SNAPSHOT/
Tilman

On 03.01.2024 09:43, Fabian Zünd SI-Solutions Gmbh wrote:
>
> 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