Am 13.04.2016 um 12:03 schrieb [email protected]:
Hi, I am new to this list.

My profile is: experienced Java programmer, knowing how to use
PDFMergerUtility, not not a PDF or even PDF/A-1b expert.

Situation: We have a bunch of PDF/A-1b compliant documents from a 3rd
party system and merge them into a new document. The end result is not
PDF/A-1b compliant though.

I found this on the mailing list archive:
http://pdfbox-users.markmail.org/search/?q=merge%20pdf%2Fa#query:merge%20pdf%2Fa+page:1+mid:uwvybz6lhgof3agg+state:results
Is there a better answer today than to look into PDFMergerUtility sources?
Because this class is what we are using, but it does not do it, at least
not in version 1.8.9. Is there a reason to assume that this has changed in
2.x?

You didn't mention what went wrong. I had that problem once with 2 files from the same source, what I did is:

1) in 2.0 source code (I won't bother with 1.8) add this in PDFMergerUtility.appendDocument() above the comment "merge logical structure hierarchy":

List<PDOutputIntent> srcOutputIntents = srcCatalog.getOutputIntents();
        for (PDOutputIntent outputIntent : srcOutputIntents)
        {
            destCatalog.addOutputIntent(outputIntent);
        }

then I edited the result PDF manually to remove one of the output intents. The result PDF should have something like this:

/OutputIntents [7 0 R 8 0 R]

just blank one of the two, e.g. like this:

/OutputIntents [7 0 R      ]

make sure that you don't change any positions, i.e. switch your editor (NOTEPAD++) to overwrite.

This may or may not work... if the two files have different output intents, then you'll have surprises, obviously.

I haven't done any code changes... I don't know for sure what element of the outputIntent is the "key" (so to skip others with the same key), and don't know what I should do if files have different ones. I suspect it is "OutputConditionIdentifier".


Example of an outputIntent:

<<
/Type/OutputIntent
/S/GTS_PDFA1
/OutputCondition(U.S. Web Coated \(SWOP\) v2)
/OutputConditionIdentifier(CGATS TR 001)
/Info(U.S. Web Coated \(SWOP\) v2)
/DestOutputProfile 4 0 R
>>

4 0 obj

<<
/N 4
/Filter/FlateDecode
/Length 389758
>>
stream
...
endstream

endobj


If you tell more what you're trying to do (one time only problem or not?), maybe I can help...

Tilman



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

Reply via email to