GraphicalPdfComparer
Overview
GraphicalPdfComparer is a class in Aspose.PDF FOSS for .NET.
Compares two PDF pages/documents graphically by rendering them to rasters and highlighting the pixels that differ.
This class provides 7 methods for working with GraphicalPdfComparer objects in .NET programs.
Available methods include: CompareDocumentsToImages, CompareDocumentsToPdf, ComparePagesToImage, ComparePagesToPdf, GetDifference, GraphicalPdfComparer.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: Color, Resolution, Threshold.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
Resolution | Resolution | Read/Write | Rendering resolution used to rasterise the pages. |
Color | Color | Read/Write | Colour used to highlight differing pixels in image output. |
Threshold | double | Read/Write | Tolerance, as a percentage (0..100), of per-channel colour difference below which two pixels are considered identical. |
Methods
| Signature | Description |
|---|---|
GraphicalPdfComparer() | Creates a comparer with default settings (150 DPI, red highlight, exact threshold). |
GetDifference(page1: Page, page2: Page) | Render both pages and compute their per-pixel difference. |
ComparePagesToImage(page1: Page, page2: Page, resultImagePath: string) | Compare two pages and write the highlighted overlay (source page with differing pixels painted Color) to an image file. |
CompareDocumentsToImages(document1: Document, document2: Document, targetDirectory: string, fileNamePrefix: string, imageFormat: GdiImageFormat) | Compare two documents page by page, writing one highlighted overlay image per page into targetDirectory. |
ComparePagesToPdf(page1: Page, page2: Page, resultPdfPath: string) | Compare two pages and append the highlighted overlay as a page in a PDF written to resultPdfPath. |
ComparePagesToPdf(page1: Page, page2: Page, pdfDocument: Document) | Compare two pages and append the highlighted overlay as a page in pdfDocument. |
CompareDocumentsToPdf(document1: Document, document2: Document, resultPdfPath: string) | Compare two documents page by page and write a single PDF whose pages hold the highlighted overlays, to resultPdfPath. |