Some test text!

platform
search

Comparing PDFs

PDFNet provides powerful document-comparison functionality. An example of this capability is shown below by comparing two PDF pages and highlighting the difference between them in red.

Document 1Document 2Difference

The following sample code demonstrates how to generate a document displaying the difference between two PDF pages:

func pdfCompareDoc(docA: PTPDFDoc, docB: PTPDFDoc, colorA: PTColorPt, colorB: PTColorPt, blendMode: PTBlendMode) -> PTPDFDoc {
    let pageA = docA.getPage(1)
    let pageB = docB.getPage(1)

    let diffOptions:PTDiffOptions = PTDiffOptions()
    diffOptions.setColorA(colorA)
    diffOptions.setColorB(colorB)
    diffOptions.setBlendMode(blendMode)

    let doc:PTPDFDoc = PTPDFDoc()
    doc.appendVisualDiff(pageA, p2: pageB, opts: diffOptions)
    return doc
}

Get the anwsers you need: Support