PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
The steps to perform a content comparison are as follows:
Open the two documents being compared.
Create the CPDFCompare object.
Set the colour and other properties of the comparison.
Call compare.doCompare() to get the comparison results and save them to the document using the generateNewDoc() method.
This example shows how to add an content comparison:
CPDFDocument baseDocument = new CPDFDocument();
baseDocument.open(rootDir + "/TestFiles/comparefile.pdf");
CPDFDocument comDocument = new CPDFDocument();
comDocument.open(rootDir + "/TestFiles/comparefile1.pdf");
printDividingLine();
CPDFCompare compare = baseDocument.createCompare(baseDocument, comDocument);
compare.setReplaceResColor(Color.decode("#93B9FD").getRGB());
compare.setInsertResColor(Color.decode("#C0FFEC").getRGB());
CPDFCompareResults result = compare.doCompare(0, 0, CPDFCompare.CompType.COMPAREALL.id, true);
compare.generateNewDoc(rootDir + "/out/compareTest.pdf");