PdfDocumentInfo implements Serializable { public PdfDocumentInfo setAuthor(String author) { return put(PdfName.Author, new PdfString(author, PdfEncodings.UNICODE_BIG)); } PdfDocumentInfo(PdfDictionary pdfObject, PdfDocument pdfDocument);   PdfDocumentInfo(PdfDocument pdfDocument); PdfDocumentInfo setTitle(String title); PdfDocumentInfo setAuthor(String author); PdfDocumentInfo setSubject(String subject); PdfDocumentInfo setKeywords(String keywords); PdfDocumentInfo setCreator(String creator); PdfDocumentInfo setTrapped(PdfName trapped); String getTitle(); String getAuthor(); String getSubject(); String getKeywords(); String getCreator(); String getProducer(); PdfName getTrapped(); PdfDocumentInfo addCreationDate(); PdfDocumentInfo addModDate(); void setMoreInfo(Map<String, String> moreInfo); void setMoreInfo(String key, String value); String getMoreInfo(String key);  }
@Test public void documentInfoCreatePdf20() throws IOException, InterruptedException { String outFile = destinationFolder + "test01.pdf"; String cmpFile = sourceFolder + "cmp_test01.pdf"; PdfDocument document = new PdfDocument(new PdfWriter(outFile, new WriterProperties().setPdfVersion(PdfVersion.PDF_2_0))); document.addNewPage(); document.getDocumentInfo().setAuthor("Alexey"); document.close(); CompareTool ct = new CompareTool(); Assert.assertNull(ct.compareByContent(outFile, cmpFile, destinationFolder, "diff_")); Assert.assertNull(ct.compareDocumentInfo(outFile, cmpFile)); Assert.assertNull(ct.compareXmp(outFile, cmpFile, true)); }
@Test public void changeDocumentVersionAndInfoInAppendMode() throws IOException, InterruptedException { String inputFile = sourceFolder + "metadata_pdf.pdf"; String outFile = destinationFolder + "metadata_pdf_20_append.pdf"; String cmpFile = sourceFolder + "cmp_metadata_pdf_20_append.pdf"; PdfDocument document = new PdfDocument(new PdfReader(inputFile), new PdfWriter(outFile, new WriterProperties().setPdfVersion(PdfVersion.PDF_2_0)), new StampingProperties().useAppendMode()); document.getDocumentInfo().setAuthor("Alexey Subach"); document.close(); CompareTool ct = new CompareTool(); Assert.assertNull(ct.compareByContent(outFile, cmpFile, destinationFolder, "diff_")); Assert.assertNull(ct.compareDocumentInfo(outFile, cmpFile)); Assert.assertNull(ct.compareXmp(outFile, cmpFile, true)); }
@Test public void changeMetadataInAppendMode() throws IOException, InterruptedException { String inputFile = sourceFolder + "cmp_metadata_pdf_20.pdf"; String outFile = destinationFolder + "metadata_pdf_20_changed_append.pdf"; String cmpFile = sourceFolder + "cmp_metadata_pdf_20_changed_append.pdf"; PdfDocument document = new PdfDocument(new PdfReader(inputFile), new PdfWriter(outFile), new StampingProperties().useAppendMode()); document.getDocumentInfo().setAuthor("Alexey Subach"); document.close(); CompareTool ct = new CompareTool(); Assert.assertNull(ct.compareByContent(outFile, cmpFile, destinationFolder, "diff_")); Assert.assertNull(ct.compareDocumentInfo(outFile, cmpFile)); Assert.assertNull(ct.compareXmp(outFile, cmpFile, true)); }