PdfDocumentComparer Class
Compares what the pages of two documents show (PdfPageElements): the pages added or removed, their size and rotation, their text and its position, the images, the paths and the shadings they paint. The pages are compared in order: the page n of a document with the page n of the other one.
public static class PdfDocumentComparerRemarks
The comparison is structural: two documents written differently (object numbers, compression, object streams) that show the same elements are equivalent, and a change of the content is reported by kind rather than as different pixels. The colors are compared by the operators that set them, and the elements by their bounding boxes.
Methods
| Name | Description |
|---|---|
| Compare(PdfDocument, PdfDocument, PdfComparisonOptions?) | Compares two documents. |
| Compare(PdfPageElements, PdfPageElements, PdfComparisonOptions?) | Compares the elements of two pages. |
Compare overloads
Compare(PdfDocument, PdfDocument, PdfComparisonOptions?)
PdfDocumentComparer.csCompares two documents.
public static PdfComparisonResult Compare(PdfDocument expected, PdfDocument actual, PdfComparisonOptions? options = null)Parameters
expectedPdfDocument- The first document, such as the expected one.
actualPdfDocument- The second document, such as the one produced.
optionsPdfComparisonOptions?- The options, or
nullforPdfComparisonOptions.Default.
Returns
PdfComparisonResult The changes of each page.
Exceptions
PdfException- The page tree of a document cannot be read.
Compare(PdfPageElements, PdfPageElements, PdfComparisonOptions?)
PdfDocumentComparer.csCompares the elements of two pages.
public static PdfPageComparison Compare(PdfPageElements expected, PdfPageElements actual, PdfComparisonOptions? options = null)Parameters
expectedPdfPageElements- The elements of the first page.
actualPdfPageElements- The elements of the second page.
optionsPdfComparisonOptions?- The options, or
nullforPdfComparisonOptions.Default.
Returns
PdfPageComparison The changes of the page.