Am 27.08.2015 um 13:43 schrieb Roberto Nibali:
Hi Tilman


On Thu, Aug 27, 2015 at 1:21 AM, Tilman Hausherr <[email protected]>
wrote:

See the AddMetadataFromDocInfo.java from the examples


PDDocumentCatalog catalog = document.getDocumentCatalog();
                 PDDocumentInformation info =
document.getDocumentInformation();


you can set stuff... and the example shows you how to do the same for the
XMP meta data.

See also the ExtractMetadata.java example.


Thanks for your valuable input. Last night I was puzzled by your answer,
after sleeping, I realized what you meant. I have solved it like follows:

private void stripInfo(PDDocument srcDoc) {
     PDDocumentInformation docInfo = srcDoc.getDocumentInformation();
     docInfo.setAuthor(null);
     docInfo.setCreationDate(null);
     docInfo.setCreator(null);
     docInfo.setKeywords(null);
     docInfo.setModificationDate(null);
     docInfo.setProducer(null);
     docInfo.setSubject(null);
     docInfo.setTitle(null);
     docInfo.setTrapped(null);
}

This is almost like you would supposedly do it with iText:

HashMap<String, String> info = super.reader.getInfo();
info.put("Title", null);
info.put("Author", null);
info.put("Subject", null);
info.put("Keywords", null);
info.put("Creator", null);
info.put("Producer", null;
info.put("CreationDate", null);
info.put("ModDate", null);
info.put("Trapped", null);
stamper.setMoreInfo(info);


Best regards
Roberto



Yes but be aware that the XMP metadata (open the PDF with an editor and search for "XMP") may also have personal information.

TIlman



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

Reply via email to