[
https://issues.apache.org/jira/browse/PDFBOX-1496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13585853#comment-13585853
]
Aleksander Bandelj commented on PDFBOX-1496:
--------------------------------------------
It works if you use same PDResources object for all PDPageContentStreams which
draw XObjects. See PDResources#addXObject, called by
PDPageContentStream#drawXObject to see how XObject identifiers are generated.
Everything would work out of the box if PDPage#getResources would return same
PDResource object for different invocations. It doesn't, and tests depend on
such behaviour. I don't understand the contract here.
You need to write subclass of PDPageContentStream with PDResources as
additional parameter ( PDDocument document, PDPage sourcePage, PDResources
resources ) and put use this in modified OverlayMergerUtility.
> Can't add multiple form XObjects to a PDF - they become duplicated
> ------------------------------------------------------------------
>
> Key: PDFBOX-1496
> URL: https://issues.apache.org/jira/browse/PDFBOX-1496
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel, Utilities
> Affects Versions: 1.7.1
> Environment: Ubuntu Linux 12.04 w/ OpenJDK 6
> Reporter: Andrew Sengul
> Labels: LayerUtility,, XObject,
>
> I've been trying to paste multiple small PDFs into a big one as form
> XObjects. This image illustrates what I'm trying to do:
> https://imageshack.us/photo/my-images/59/pdfsampleimagepasterigh.png/
> The Test 1-3 boxes would be the little PDFs I want to insert. When I try to
> do this, I get this result:
> https://imageshack.us/photo/my-images/15/pdfsampleimagepastewron.png/
> The last form to be pasted is just duplicated three times. It seems that
> instead of adding multiple XObjects, I am just adding multiple references to
> a single XObject, and whenever I try to add another XObject it just
> overwrites the XObject that the form instances were referring to. It seems I
> can't insert multiple forms, just multiple references to a single one.
> I have uploaded a zip file containing everything that should be needed to
> reproduce this bug here:
> http://wpmucloud.com/form_insertion_failure_test.zip
> Once this is unzipped in a *nix environment, you can run the build.sh script
> to build the AddTagToPDF class. Then you can run the test.sh script to run a
> test, creating three PDFs with the decals pasted onto them. The three decals
> should be distinct, but as you will see, they end up getting duplicated.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira