public class GraphicalPdfComparer extends Object
Represents a class for graphically comparing PDF documents. Should be used to search for small changes, mainly of a graphical nature. To compare text content changes, use other PDF comparison classes.
Constructor and Description |
---|
GraphicalPdfComparer()
Creates an instance of
GraphicalPdfComparer class. |
Modifier and Type | Method and Description |
---|---|
void |
compareDocumentsToImages(Document document1,
Document document2,
String targetDirectory,
String fileNamePrefix,
com.aspose.ms.System.Drawing.Imaging.ImageFormat imageFormat)
Compares documents graphically.
|
void |
compareDocumentsToPdf(Document document1,
Document document2,
String resultPdfPath)
Compares documents graphically.
|
void |
comparePagesToImage(Page page1,
Page page2,
String resultImagePath)
Compares pages graphically.
|
void |
comparePagesToPdf(Page page1,
Page page2,
Document pdfDocument)
Compares pages graphically.
|
void |
comparePagesToPdf(Page page1,
Page page2,
String resultPdfPath)
Compares pages graphically.
|
Color |
getColor()
Gets and sets the change flag color.
|
ImagesDifference |
getDifference(Page page1,
Page page2)
Gets differences between pages images.
|
Resolution |
getResolution()
Gets and sets the resolution of the resulting images.
|
double |
getThreshold()
Gets and sets the threshold value in percentage.
|
void |
setColor(Color value)
Gets and sets the change flag color.
|
void |
setResolution(Resolution value)
Gets and sets the resolution of the resulting images.
|
void |
setThreshold(double value)
Gets and sets the threshold value in percentage.
|
public GraphicalPdfComparer()
Creates an instance of GraphicalPdfComparer
class.
public final Resolution getResolution()
Gets and sets the resolution of the resulting images. The default value is 150dpi.
public final void setResolution(Resolution value)
Gets and sets the resolution of the resulting images. The default value is 150dpi.
value
- Resolution instancepublic final Color getColor()
Gets and sets the change flag color. The default color is red.
public final void setColor(Color value)
Gets and sets the change flag color. The default color is red.
value
- Color instancepublic final double getThreshold()
Gets and sets the threshold value in percentage. This value allows you to ignore small changes if they are not significant to you. The default value is 0%.
public final void setThreshold(double value)
Gets and sets the threshold value in percentage. This value allows you to ignore small changes if they are not significant to you. The default value is 0%.
value
- double valuepublic final ImagesDifference getDifference(Page page1, Page page2)
Gets differences between pages images. The result contains an image of the first page compared and an array of differences.
page1
- The first page.page2
- The second page.ImagesDifference
instance.com.aspose.ms.System.ArgumentException
- If the pages being compared are of different sizes.public final void comparePagesToPdf(Page page1, Page page2, String resultPdfPath)
Compares pages graphically. The comparison result is placed in a PDF document.
page1
- The first page.page2
- The second page.resultPdfPath
- The path to target pdf file.com.aspose.ms.System.ArgumentException
- If the pages being compared are of different sizes.
If resultPdfPath is null or empty string.public final void comparePagesToPdf(Page page1, Page page2, Document pdfDocument)
Compares pages graphically. The comparison result is placed in a PDF document.
page1
- The first page.page2
- The second page.pdfDocument
- The pdf document instance.com.aspose.ms.System.ArgumentException
- If the pages being compared are of different sizes.public final void compareDocumentsToPdf(Document document1, Document document2, String resultPdfPath)
Compares documents graphically. The comparison result is placed in a PDF document.
document1
- The first document to compare.document2
- The second document to compare.resultPdfPath
- The target pdf file path.com.aspose.ms.System.ArgumentException
- If the pages being compared are of different sizes.
If resultPdfPath is null or empty string.public final void comparePagesToImage(Page page1, Page page2, String resultImagePath)
Compares pages graphically. The comparison result is placed in a image.
page1
- The first page to compare.page2
- The second page to compare.resultImagePath
- The path to target image file.com.aspose.ms.System.ArgumentException
- If the pages being compared are of different sizes.
If resultImagePath is null or empty string.
There is unknown saving image format.public final void compareDocumentsToImages(Document document1, Document document2, String targetDirectory, String fileNamePrefix, com.aspose.ms.System.Drawing.Imaging.ImageFormat imageFormat)
Compares documents graphically. The comparison result is placed in images.
document1
- The first document to compare.document2
- The second document to compare.targetDirectory
- The directory to save a comparison results.fileNamePrefix
- The images name prefix.imageFormat
- The image format to save.com.aspose.ms.System.ArgumentException
- If the pages being compared are of different sizes.
If targetDirectory is null or empty string.
If fileNamePrefix is null or empty string.Copyright © 2025 Aspose. All Rights Reserved.