[
https://issues.apache.org/jira/browse/PDFBOX-5939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17921180#comment-17921180
]
ASF subversion and git services commented on PDFBOX-5939:
---------------------------------------------------------
Commit 1923378 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1923378 ]
PDFBOX-5939: ignore outline that is its own parent
> Merge docs with specific characteristics causes stack overflow
> --------------------------------------------------------------
>
> Key: PDFBOX-5939
> URL: https://issues.apache.org/jira/browse/PDFBOX-5939
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.33, 3.0.3 PDFBox
> Environment: Mac local development env
> Linux production env
> Reporter: Ryan McKay
> Priority: Major
> Attachments: form-elements.pdf, google-docs-1.pdf, google-docs-2.pdf,
> image-2025-01-26-16-12-52-443.png
>
>
> Merging specific docs in a specific order causes a stack overflow. We've
> noticed that a common thread is that one of the docs was exported from Google
> Docs. Order matters. If a Google docs PDF is followed by another Google
> docs PDF (either itself again or a different one) or a PDF with form
> elements, the problem is encountered. Interspersing other docs that don't
> have those characteristics doesn't affect the outcome. Form elements
> followed by Google docs works fine also.
> The specific code that encounters the problem is as follows:
> {code:java}
> PDFMergerUtility PDFmerger = new PDFMergerUtility();
> PDFmerger.setDestinationFileName(outputFile.getAbsolutePath());
> for (File f : files) {
> PDFmerger.addSource(f);
> }
> PDFmerger.mergeDocuments(MemoryUsageSetting.setupTempFileOnly()); {code}
> We also encounter the problem using the CLI's pdfbox-app-2.0.22.jar and
> pdfbox-app-3.0.3.jar.
> We found that adding the following fixed the problem:
> {code:java}
> PDFmerger.setDocumentMergeMode(PDFMergerUtility.DocumentMergeMode.OPTIMIZE_RESOURCES_MODE);
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]