You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2018/04/19 16:28:00 UTC

[jira] [Commented] (PDFBOX-3999) Merge failed to clone tags

    [ https://issues.apache.org/jira/browse/PDFBOX-3999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16444344#comment-16444344 ] 

ASF subversion and git services commented on PDFBOX-3999:
---------------------------------------------------------

Commit 1829574 from [~tilman] in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1829574 ]

PDFBOX-3999: clone objects not in mapping to prevent them from remaining attached to the source document

> Merge failed to clone tags
> --------------------------
>
>                 Key: PDFBOX-3999
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3999
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.0.8
>            Reporter: Dave Hill
>            Priority: Critical
>              Labels: StructureTree, merge
>         Attachments: GeneralForbearance.pdf, GovFormPreFlattened.pdf, pdfbox.patch
>
>
> After merging two tagged documents, closing the source document causes the destination document to be closed, which prevents it from being saved. The following code demonstrates the bug with the attached flattened government PDF file. The original is available [here|https://studentloans.gov/myDirectLoan/downloadForm.action?searchType=library&shortName=general&localeCode=en-us] if you need it.
> {code}
> @Test
> public void testMerge() throws Exception {
>     PDFMergerUtility pdfMergerUtility = new PDFMergerUtility();
>     PDDocument src = PDDocument.load(new File("GovFormPreFlattened.pdf"));
>     PDDocument dest = PDDocument.load(new File("GovFormPreFlattened.pdf"));
>     pdfMergerUtility.appendDocument(dest, src);
>     src.close(); //if we don't close the src then we don't have an error
>     dest.save(File.createTempFile("MergeIssue",".PDF"));
>     dest.close();
> }
> {code}
> The issue is resolved with the attached patch.
> Also I removed the "if (mergeStructTree)" is because mergeStructTree is always true here because this code is already inside an "if (mergeStructTree)".



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org