[ 
https://issues.apache.org/jira/browse/PDFBOX-6202?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alexander Pinske updated PDFBOX-6202:
-------------------------------------
    Component/s: PDModel

> Possible regression when combining multiple PDFs
> ------------------------------------------------
>
>                 Key: PDFBOX-6202
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6202
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 3.0.7 PDFBox
>            Reporter: Alexander Pinske
>            Priority: Major
>         Attachments: X1.pdf, X2.pdf, X_actual.pdf, X_expected.pdf
>
>
> Worked in 3.0.6, might be a regression caused by PDFBOX-6036.
> {code:java}
>     @Test
>     void testPDFBoxX() throws IOException
>     {
>         try (PDDocument d1 = Loader.loadPDF(new 
> RandomAccessReadBuffer(getClass().getResourceAsStream("/input/X1.pdf")));
>              PDDocument d2 = Loader.loadPDF(new 
> RandomAccessReadBuffer(getClass().getResourceAsStream("/input/X2.pdf")));
>              PDDocument d = new PDDocument()) {
>             List<PDPage> pages = new ArrayList<>();
>             d1.getPages().forEach(pages::add);
>             d2.getPages().forEach(pages::add);
>             for (PDPage page : pages) {
>                 d.addPage(page);
>             }
>             d.save(new FileOutputStream("target/X.pdf"));
>         }
>     }
> {code}
> It starts working again, when I add this line before the call to addPage:
> {code:java}
> page.getCOSObject().resetImportedObjectKeys();
> {code}
> I do know about importPage, but we are not using that to avoid an extra copy, 
> as the source pdfs are discarded after.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to