CompareTool { public String compareDocumentInfo(String outPdf, String cmpPdf, byte[] outPass, byte[] cmpPass) throws IOException { System.out.print("[itext] INFO Comparing document info......."); String message = null; setPassword(outPass, cmpPass); PdfDocument outDocument = new PdfDocument(new PdfReader(outPdf, getOutReaderProperties()), new DocumentProperties().setEventCountingMetaInfo(metaInfo)); PdfDocument cmpDocument = new PdfDocument(new PdfReader(cmpPdf, getCmpReaderProperties()), new DocumentProperties().setEventCountingMetaInfo(metaInfo)); String[] cmpInfo = convertInfo(cmpDocument.getDocumentInfo()); String[] outInfo = convertInfo(outDocument.getDocumentInfo()); for (int i = 0; i < cmpInfo.length; ++i) { if (!cmpInfo[i].equals(outInfo[i])) { message = MessageFormatUtil.format("Document info fail. Expected: \"{0}\", actual: \"{1}\"", cmpInfo[i], outInfo[i]); break; } } outDocument.close(); cmpDocument.close(); if (message == null) System.out.println("OK"); else System.out.println("Fail"); System.out.flush(); return message; } CompareTool();   CompareTool(String gsExec, String compareExec); CompareResult compareByCatalog(PdfDocument outDocument, PdfDocument cmpDocument); CompareTool disableCachedPagesComparison(); CompareTool setCompareByContentErrorsLimit(int compareByContentMaxErrorCount); CompareTool setGenerateCompareByContentXmlReport(boolean generateCompareByContentXmlReport); void setEventCountingMetaInfo(IMetaInfo metaInfo); CompareTool enableEncryptionCompare(); ReaderProperties getOutReaderProperties(); ReaderProperties getCmpReaderProperties(); String compareVisually(String outPdf, String cmpPdf, String outPath, String differenceImagePrefix); String compareVisually(String outPdf, String cmpPdf, String outPath, String differenceImagePrefix, Map<Integer, List<Rectangle>> ignoredAreas); String compareByContent(String outPdf, String cmpPdf, String outPath); String compareByContent(String outPdf, String cmpPdf, String outPath, String differenceImagePrefix); String compareByContent(String outPdf, String cmpPdf, String outPath, String differenceImagePrefix, byte[] outPass, byte[] cmpPass); String compareByContent(String outPdf, String cmpPdf, String outPath, String differenceImagePrefix, Map<Integer, List<Rectangle>> ignoredAreas); String compareByContent(String outPdf, String cmpPdf, String outPath, String differenceImagePrefix, Map<Integer, List<Rectangle>> ignoredAreas, byte[] outPass, byte[] cmpPass); boolean compareDictionaries(PdfDictionary outDict, PdfDictionary cmpDict); CompareResult compareDictionariesStructure(PdfDictionary outDict, PdfDictionary cmpDict); CompareResult compareDictionariesStructure(PdfDictionary outDict, PdfDictionary cmpDict, Set<PdfName> excludedKeys); CompareResult compareStreamsStructure(PdfStream outStream, PdfStream cmpStream); boolean compareStreams(PdfStream outStream, PdfStream cmpStream); boolean compareArrays(PdfArray outArray, PdfArray cmpArray); boolean compareNames(PdfName outName, PdfName cmpName); boolean compareNumbers(PdfNumber outNumber, PdfNumber cmpNumber); boolean compareStrings(PdfString outString, PdfString cmpString); boolean compareBooleans(PdfBoolean outBoolean, PdfBoolean cmpBoolean); String compareXmp(String outPdf, String cmpPdf); String compareXmp(String outPdf, String cmpPdf, boolean ignoreDateAndProducerProperties); boolean compareXmls(byte[] xml1, byte[] xml2); boolean compareXmls(String outXmlFile, String cmpXmlFile); String compareDocumentInfo(String outPdf, String cmpPdf, byte[] outPass, byte[] cmpPass); String compareDocumentInfo(String outPdf, String cmpPdf); String compareLinkAnnotations(String outPdf, String cmpPdf); String compareTagStructures(String outPdf, String cmpPdf);  }
@Test public void differentProducerTest() throws IOException { String expectedMessage = "Document info fail. Expected: \"iText\u00ae <version> \u00a9<copyright years> iText Group NV (iText Software; licensed version)\", actual: \"iText\u00ae <version> \u00a9<copyright years> iText Group NV (AGPL-version)\""; String licensed = sourceFolder + "producerLicensed.pdf"; String agpl = sourceFolder + "producerAGPL.pdf"; Assert.assertEquals(expectedMessage, new CompareTool().compareDocumentInfo(agpl, licensed)); }