Hi Tilman On Thu, Aug 27, 2015 at 4:19 PM, Tilman Hausherr <[email protected]> wrote:
> 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. Sure. I already wrote some code to detect it. The PDFs to deal with do not have XMP sections. Thanks for your continuous valuable help! Cheers Roberto

