[ https://issues.apache.org/jira/browse/PDFBOX-3323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15251877#comment-15251877 ]
Alexander Kriegisch commented on PDFBOX-3323: --------------------------------------------- Okay, I also did this and the document gets created successfully and Acrobat Reader shows the desired infos: {code} logger.trace("Setting document info (title, author, subject) for merged PDF"); PDDocumentInformation documentInformation = new PDDocumentInformation(); documentInformation.setTitle(title); documentInformation.setCreator(creator); documentInformation.setSubject(subject); merger.setDestinationDocumentInformation(documentInformation); logger.trace("Setting XMP metadata (title, author, subject) for merged PDF"); COSStream cosStream = new COSStream(); try( InputStream stream = PdfBoxWrapper.class.getResourceAsStream("/my/resource/XMP_Metadata.xml"); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); OutputStream xmpCosStream = cosStream.createOutputStream() ) { String xmpTemplate = reader.lines().collect(Collectors.joining("\n")) .replace("###title###", title) .replace("###creator###", creator) .replace("###subject###", subject); xmpCosStream.write(xmpTemplate.getBytes()); PDMetadata newMetadata = new PDMetadata(cosStream); merger.setDestinationMetadata(newMetadata); } merger.mergeDocuments(MemoryUsageSetting.setupMainMemoryOnly()); {code} Unfortunately, veraPDF validator says: > Specification: ISO 19005-1:2005, Clause: 6.7.3, Test number: 1 > > If a document information dictionary does appear at a document, then all of > its entries that have analogous properties in predefined XMP schemas, shall > also be embedded in the file in XMP form with equivalent values. > > Failed > Cannot set destination meta data in PDFMergerUtility > ---------------------------------------------------- > > Key: PDFBOX-3323 > URL: https://issues.apache.org/jira/browse/PDFBOX-3323 > Project: PDFBox > Issue Type: Improvement > Affects Versions: 1.8.9, 2.0.0 > Reporter: Alexander Kriegisch > Labels: merge, metadata > > When merging multiple PDFs into one compound document via > {{PDFMergerUtility}}, meta data like title, author, subject cannot be set but > seem to be taken from one of the input documents. This is usually not the > desired behaviour because as a user I have no direct influence on the meta > data. As a user I would like to explicitly set or at least overwrite certain > meta data for the destination document. Currently I can only set the > destination stream or file name, but not the meta data. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org