Table of Contents

Class CompareTool

Namespace
iText.Kernel.Utils
Assembly
itext.kernel.dll

This class provides means to compare two PDF files both by content and visually and gives the report on their differences.

public class CompareTool
Inheritance
CompareTool
Inherited Members

Remarks

This class provides means to compare two PDF files both by content and visually and gives the report on their differences.

For visual comparison it uses external tools: Ghostscript and ImageMagick, which should be installed on your machine. To allow CompareTool to use them, you need to pass either java properties or environment variables with names "ITEXT_GS_EXEC" and "ITEXT_MAGICK_COMPARE_EXEC", which would contain the commands to execute the Ghostscript and ImageMagick tools.

CompareTool class was mainly designed for the testing purposes of iText in order to ensure that the same code produces the same PDF document. For this reason you will often encounter such parameter names as "outDoc" and "cmpDoc" which stand for output document and document-for-comparison. The first one is viewed as the current result, and the second one is referred as normal or ideal result. OutDoc is compared to the ideal cmpDoc. Therefore all reports of the comparison are in the form: "Expected ..., but was ...". This should be interpreted in the following way: "expected" part stands for the content of the cmpDoc and "but was" part stands for the content of the outDoc.

Constructors

CompareTool()

Create new CompareTool instance.

public CompareTool()

Methods

Cleanup(string)

Clean up memory occupied for the tests.

public static void Cleanup(string path)

Parameters

path string

Path to clean up memory for.

CompareArrays(PdfArray, PdfArray)

Simple method that compares two given PdfArrays by content.

public virtual bool CompareArrays(PdfArray outArray, PdfArray cmpArray)

Parameters

outArray PdfArray

array to compare.

cmpArray PdfArray

array to compare.

Returns

bool

true if arrays are equal by content, otherwise false.

Remarks

Simple method that compares two given PdfArrays by content. This is "deep" comparing, which means that all nested objects are also compared by content.

CompareBooleans(PdfBoolean, PdfBoolean)

Simple method that compares two given PdfBooleans.

public virtual bool CompareBooleans(PdfBoolean outBoolean, PdfBoolean cmpBoolean)

Parameters

outBoolean PdfBoolean

boolean to compare.

cmpBoolean PdfBoolean

boolean to compare.

Returns

bool

true if booleans are equal, otherwise false.

CompareByCatalog(PdfDocument, PdfDocument)

Compares two PDF documents by content starting from Catalog dictionary and then recursively comparing corresponding objects which are referenced from it.

public virtual CompareTool.CompareResult CompareByCatalog(PdfDocument outDocument, PdfDocument cmpDocument)

Parameters

outDocument PdfDocument

a PdfDocument corresponding to the output file, which is to be compared with cmp-file.

cmpDocument PdfDocument

a PdfDocument corresponding to the cmp-file, which is to be compared with output file.

Returns

CompareTool.CompareResult

the report on comparison of two files in the form of the custom class CompareTool.CompareResult instance.

Remarks

Compares two PDF documents by content starting from Catalog dictionary and then recursively comparing corresponding objects which are referenced from it. You can roughly imagine it as depth-first traversal of the two trees that represent pdf objects structure of the documents.

The main difference between this method and the CompareByContent(string, string, string, string) methods is the return value. This method returns a CompareTool.CompareResult class instance, which could be used in code, whilst compareByContent methods in case of the differences simply return String value, which could only be printed. Also, keep in mind that this method doesn't perform visual comparison of the documents.

For more explanations about what outDoc and cmpDoc are see last paragraph of the CompareTool class description.
See Also

CompareByContent(string, string, string)

Compares two PDF documents by content starting from page dictionaries and then recursively comparing corresponding objects which are referenced from them.

public virtual string CompareByContent(string outPdf, string cmpPdf, string outPath)

Parameters

outPdf string

the absolute path to the output file, which is to be compared to cmp-file.

cmpPdf string

the absolute path to the cmp-file, which is to be compared to output file.

outPath string

the absolute path to the folder, which will be used to store image files for visual comparison.

Returns

string

string containing text report on the encountered content differences and also list of the pages that are visually different, or null if there are no content and therefore no visual differences.

Remarks

Compares two PDF documents by content starting from page dictionaries and then recursively comparing corresponding objects which are referenced from them. You can roughly imagine it as depth-first traversal of the two trees that represent pdf objects structure of the documents.

When comparison by content is finished, if any differences were found, visual comparison is automatically started. For this overload, differenceImagePrefix value is generated using diff_%outPdfFileName%_ format.

For more explanations about what outPdf and cmpPdf are see last paragraph of the CompareTool class description.
See Also

CompareByContent(string, string, string, string)

Compares two PDF documents by content starting from page dictionaries and then recursively comparing corresponding objects which are referenced from them.

public virtual string CompareByContent(string outPdf, string cmpPdf, string outPath, string differenceImagePrefix)

Parameters

outPdf string

the absolute path to the output file, which is to be compared to cmp-file.

cmpPdf string

the absolute path to the cmp-file, which is to be compared to output file.

outPath string

the absolute path to the folder, which will be used to store image files for visual comparison.

differenceImagePrefix string

file name prefix for image files with marked visual differences if there are any; if it's set to null the prefix defaults to diff_%outPdfFileName%_ format.

Returns

string

string containing text report on the encountered content differences and also list of the pages that are visually different, or null if there are no content and therefore no visual differences.

Remarks

Compares two PDF documents by content starting from page dictionaries and then recursively comparing corresponding objects which are referenced from them. You can roughly imagine it as depth-first traversal of the two trees that represent pdf objects structure of the documents.

When comparison by content is finished, if any differences were found, visual comparison is automatically started.

For more explanations about what outPdf and cmpPdf are see last paragraph of the CompareTool class description.
See Also

CompareByContent(string, string, string, string, byte[], byte[])

This method overload is used to compare two encrypted PDF documents.

public virtual string CompareByContent(string outPdf, string cmpPdf, string outPath, string differenceImagePrefix, byte[] outPass, byte[] cmpPass)

Parameters

outPdf string

the absolute path to the output file, which is to be compared to cmp-file.

cmpPdf string

the absolute path to the cmp-file, which is to be compared to output file.

outPath string

the absolute path to the folder, which will be used to store image files for visual comparison.

differenceImagePrefix string

file name prefix for image files with marked visual differences if there is any; if it's set to null the prefix defaults to diff_%outPdfFileName%_ format.

outPass byte[]

password for the encrypted document specified by the outPdf absolute path.

cmpPass byte[]

password for the encrypted document specified by the cmpPdf absolute path.

Returns

string

string containing text report on the encountered content differences and also list of the pages that are visually different, or null if there are no content and therefore no visual differences.

Remarks

This method overload is used to compare two encrypted PDF documents. Document passwords are passed with outPass and cmpPass parameters.

Compares two PDF documents by content starting from page dictionaries and then recursively comparing corresponding objects which are referenced from them. You can roughly imagine it as depth-first traversal of the two trees that represent pdf objects structure of the documents.

When comparison by content is finished, if any differences were found, visual comparison is automatically started. For more info see CompareVisually(string, string, string, string).

For more explanations about what outPdf and cmpPdf are see last paragraph of the CompareTool class description.
See Also

CompareByContent(string, string, string, string, IDictionary<int, IList<Rectangle>>)

Compares two PDF documents by content starting from page dictionaries and then recursively comparing corresponding objects which are referenced from them.

public virtual string CompareByContent(string outPdf, string cmpPdf, string outPath, string differenceImagePrefix, IDictionary<int, IList<Rectangle>> ignoredAreas)

Parameters

outPdf string

the absolute path to the output file, which is to be compared to cmp-file.

cmpPdf string

the absolute path to the cmp-file, which is to be compared to output file.

outPath string

the absolute path to the folder, which will be used to store image files for visual comparison.

differenceImagePrefix string

file name prefix for image files with marked visual differences if there are any; if it's set to null the prefix defaults to diff_%outPdfFileName%_ format.

ignoredAreas IDictionary<int, IList<Rectangle>>

a map with one-based page numbers as keys and lists of ignored rectangles as values.

Returns

string

string containing text report on the encountered content differences and also list of the pages that are visually different, or null if there are no content and therefore no visual differences.

Remarks

Compares two PDF documents by content starting from page dictionaries and then recursively comparing corresponding objects which are referenced from them. You can roughly imagine it as depth-first traversal of the two trees that represent pdf objects structure of the documents.

When comparison by content is finished, if any differences were found, visual comparison is automatically started.

For more explanations about what outPdf and cmpPdf are see last paragraph of the CompareTool class description.
See Also

CompareByContent(string, string, string, string, IDictionary<int, IList<Rectangle>>, byte[], byte[])

This method overload is used to compare two encrypted PDF documents.

public virtual string CompareByContent(string outPdf, string cmpPdf, string outPath, string differenceImagePrefix, IDictionary<int, IList<Rectangle>> ignoredAreas, byte[] outPass, byte[] cmpPass)

Parameters

outPdf string

the absolute path to the output file, which is to be compared to cmp-file.

cmpPdf string

the absolute path to the cmp-file, which is to be compared to output file.

outPath string

the absolute path to the folder, which will be used to store image files for visual comparison.

differenceImagePrefix string

file name prefix for image files with marked visual differences if there are any; if it's set to null the prefix defaults to diff_%outPdfFileName%_ format.

ignoredAreas IDictionary<int, IList<Rectangle>>

a map with one-based page numbers as keys and lists of ignored rectangles as values.

outPass byte[]

password for the encrypted document specified by the outPdf absolute path.

cmpPass byte[]

password for the encrypted document specified by the cmpPdf absolute path.

Returns

string

string containing text report on the encountered content differences and also list of the pages that are visually different, or null if there are no content and therefore no visual differences.

Remarks

This method overload is used to compare two encrypted PDF documents. Document passwords are passed with outPass and cmpPass parameters.

Compares two PDF documents by content starting from page dictionaries and then recursively comparing corresponding objects which are referenced from them. You can roughly imagine it as depth-first traversal of the two trees that represent pdf objects structure of the documents.

When comparison by content is finished, if any differences were found, visual comparison is automatically started.

For more explanations about what outPdf and cmpPdf are see last paragraph of the CompareTool class description.
See Also

CompareDictionaries(PdfDictionary, PdfDictionary)

Simple method that compares two given PdfDictionaries by content.

public virtual bool CompareDictionaries(PdfDictionary outDict, PdfDictionary cmpDict)

Parameters

outDict PdfDictionary

dictionary to compare.

cmpDict PdfDictionary

dictionary to compare.

Returns

bool

true if dictionaries are equal by content, otherwise false.

Remarks

Simple method that compares two given PdfDictionaries by content. This is "deep" comparing, which means that all nested objects are also compared by content.

CompareDictionariesStructure(PdfDictionary, PdfDictionary)

Recursively compares structures of two corresponding dictionaries from out and cmp PDF documents.

public virtual CompareTool.CompareResult CompareDictionariesStructure(PdfDictionary outDict, PdfDictionary cmpDict)

Parameters

outDict PdfDictionary

an indirect PdfDictionary from the output file, which is to be compared to cmp-file dictionary.

cmpDict PdfDictionary

an indirect PdfDictionary from the cmp-file file, which is to be compared to output file dictionary.

Returns

CompareTool.CompareResult

CompareTool.CompareResult instance containing differences between the two dictionaries, or null if dictionaries are equal.

Remarks

Recursively compares structures of two corresponding dictionaries from out and cmp PDF documents. You can roughly imagine it as depth-first traversal of the two trees that represent pdf objects structure of the documents.

Both out and cmp PdfDictionary shall have indirect references.

By default page dictionaries are excluded from the comparison when met and are instead compared in a special manner, simply comparing their page numbers. This behavior can be disabled by calling DisableCachedPagesComparison().

For more explanations about what outPdf and cmpPdf are see last paragraph of the CompareTool class description.

CompareDictionariesStructure(PdfDictionary, PdfDictionary, ICollection<PdfName>)

Recursively compares structures of two corresponding dictionaries from out and cmp PDF documents.

public virtual CompareTool.CompareResult CompareDictionariesStructure(PdfDictionary outDict, PdfDictionary cmpDict, ICollection<PdfName> excludedKeys)

Parameters

outDict PdfDictionary

an indirect PdfDictionary from the output file, which is to be compared to cmp-file dictionary.

cmpDict PdfDictionary

an indirect PdfDictionary from the cmp-file file, which is to be compared to output file dictionary.

excludedKeys ICollection<PdfName>

a of names that designate entries from outDict and cmpDict dictionaries which are to be skipped during comparison.

Returns

CompareTool.CompareResult

CompareTool.CompareResult instance containing differences between the two dictionaries, or null if dictionaries are equal.

Remarks

Recursively compares structures of two corresponding dictionaries from out and cmp PDF documents. You can roughly imagine it as depth-first traversal of the two trees that represent pdf objects structure of the documents.

Both out and cmp PdfDictionary shall have indirect references.

By default page dictionaries are excluded from the comparison when met and are instead compared in a special manner, simply comparing their page numbers. This behavior can be disabled by calling DisableCachedPagesComparison().

For more explanations about what outPdf and cmpPdf are see last paragraph of the CompareTool class description.

CompareDocumentInfo(string, string)

Compares document info dictionaries of two pdf documents.

public virtual string CompareDocumentInfo(string outPdf, string cmpPdf)

Parameters

outPdf string

the absolute path to the output file, which info is to be compared to cmp-file info.

cmpPdf string

the absolute path to the cmp-file, which info is to be compared to output file info.

Returns

string

text report on the differences in documents infos.

CompareDocumentInfo(string, string, byte[], byte[])

Compares document info dictionaries of two pdf documents.

public virtual string CompareDocumentInfo(string outPdf, string cmpPdf, byte[] outPass, byte[] cmpPass)

Parameters

outPdf string

the absolute path to the output file, which info is to be compared to cmp-file info.

cmpPdf string

the absolute path to the cmp-file, which info is to be compared to output file info.

outPass byte[]

password for the encrypted document specified by the outPdf absolute path.

cmpPass byte[]

password for the encrypted document specified by the cmpPdf absolute path.

Returns

string

text report on the differences in documents infos.

Remarks

Compares document info dictionaries of two pdf documents.

This method overload is used to compare two encrypted PDF documents. Document passwords are passed with outPass and cmpPass parameters.

CompareLinkAnnotations(string, string)

Checks if two documents have identical link annotations on corresponding pages.

public virtual string CompareLinkAnnotations(string outPdf, string cmpPdf)

Parameters

outPdf string

the absolute path to the output file, which links are to be compared to cmp-file links.

cmpPdf string

the absolute path to the cmp-file, which links are to be compared to output file links.

Returns

string

text report on the differences in documents links.

CompareNames(PdfName, PdfName)

Simple method that compares two given PdfNames.

public virtual bool CompareNames(PdfName outName, PdfName cmpName)

Parameters

outName PdfName

name to compare.

cmpName PdfName

name to compare.

Returns

bool

true if names are equal, otherwise false.

CompareNumbers(PdfNumber, PdfNumber)

Simple method that compares two given PdfNumbers.

public virtual bool CompareNumbers(PdfNumber outNumber, PdfNumber cmpNumber)

Parameters

outNumber PdfNumber

number to compare.

cmpNumber PdfNumber

number to compare.

Returns

bool

true if numbers are equal, otherwise false.

CompareObjects(PdfObject, PdfObject, ObjectPath, CompareResult)

Compare PDF objects.

protected virtual bool CompareObjects(PdfObject outObj, PdfObject cmpObj, ObjectPath currentPath, CompareTool.CompareResult compareResult)

Parameters

outObj PdfObject

out object corresponding to the output file, which is to be compared with cmp object

cmpObj PdfObject

cmp object corresponding to the cmp-file, which is to be compared with out object

currentPath ObjectPath

current objects ObjectPath path

compareResult CompareTool.CompareResult

CompareTool.CompareResult for the results of the comparison of the two documents

Returns

bool

true if objects are equal, false otherwise.

CompareStreams(PdfStream, PdfStream)

Simple method that compares two given PdfStreams by content.

public virtual bool CompareStreams(PdfStream outStream, PdfStream cmpStream)

Parameters

outStream PdfStream

stream to compare.

cmpStream PdfStream

stream to compare.

Returns

bool

true if stream are equal by content, otherwise false.

Remarks

Simple method that compares two given PdfStreams by content. This is "deep" comparing, which means that all nested objects are also compared by content.

CompareStreamsStructure(PdfStream, PdfStream)

Compares structures of two corresponding streams from out and cmp PDF documents.

public virtual CompareTool.CompareResult CompareStreamsStructure(PdfStream outStream, PdfStream cmpStream)

Parameters

outStream PdfStream

a PdfStream from the output file, which is to be compared to cmp-file stream.

cmpStream PdfStream

a PdfStream from the cmp-file file, which is to be compared to output file stream.

Returns

CompareTool.CompareResult

CompareTool.CompareResult instance containing differences between the two streams, or null if streams are equal.

Remarks

Compares structures of two corresponding streams from out and cmp PDF documents. You can roughly imagine it as depth-first traversal of the two trees that represent pdf objects structure of the documents.

For more explanations about what outPdf and cmpPdf are see last paragraph of the CompareTool class description.

CompareStrings(PdfString, PdfString)

Simple method that compares two given PdfStrings.

public virtual bool CompareStrings(PdfString outString, PdfString cmpString)

Parameters

outString PdfString

string to compare.

cmpString PdfString

string to compare.

Returns

bool

true if strings are equal, otherwise false.

CompareTagStructures(string, string)

Compares tag structures of the two PDF documents.

public virtual string CompareTagStructures(string outPdf, string cmpPdf)

Parameters

outPdf string

the absolute path to the output file, which tags are to be compared to cmp-file tags.

cmpPdf string

the absolute path to the cmp-file, which tags are to be compared to output file tags.

Returns

string

text report of the differences in documents tags.

Remarks

Compares tag structures of the two PDF documents.

This method creates xml files in the same folder with outPdf file. These xml files contain documents tag structures converted into the xml structure. These xml files are compared if they are equal.

CompareVisually(string, string, string, string)

Compares two documents visually.

public virtual string CompareVisually(string outPdf, string cmpPdf, string outPath, string differenceImagePrefix)

Parameters

outPdf string

the absolute path to the output file, which is to be compared to cmp-file.

cmpPdf string

the absolute path to the cmp-file, which is to be compared to output file.

outPath string

the absolute path to the folder, which will be used to store image files for visual comparison.

differenceImagePrefix string

file name prefix for image files with marked differences if there is any.

Returns

string

string containing list of the pages that are visually different, or null if there are no visual differences.

Remarks

Compares two documents visually. For the comparison two external tools are used: Ghostscript and ImageMagick. For more info about needed configuration for visual comparison process see CompareTool class description.

Note, that this method uses ImageMagickHelper and GhostscriptHelper classes and therefore may create temporary files and directories.

During comparison for every page of the two documents an image file will be created in the folder specified by outPath parameter. Then those page images will be compared and if there are any differences for some pages, another image file will be created with marked differences on it.

CompareVisually(string, string, string, string, IDictionary<int, IList<Rectangle>>)

Compares two documents visually.

public virtual string CompareVisually(string outPdf, string cmpPdf, string outPath, string differenceImagePrefix, IDictionary<int, IList<Rectangle>> ignoredAreas)

Parameters

outPdf string

the absolute path to the output file, which is to be compared to cmp-file.

cmpPdf string

the absolute path to the cmp-file, which is to be compared to output file.

outPath string

the absolute path to the folder, which will be used to store image files for visual comparison.

differenceImagePrefix string

file name prefix for image files with marked differences if there is any.

ignoredAreas IDictionary<int, IList<Rectangle>>

a map with one-based page numbers as keys and lists of ignored rectangles as values.

Returns

string

string containing list of the pages that are visually different, or null if there are no visual differences.

Remarks

Compares two documents visually. For the comparison two external tools are used: Ghostscript and ImageMagick. For more info about needed configuration for visual comparison process see CompareTool class description.

Note, that this method uses ImageMagickHelper and GhostscriptHelper classes and therefore may create temporary files and directories.

During comparison for every page of two documents an image file will be created in the folder specified by outPath parameter. Then those page images will be compared and if there are any differences for some pages, another image file will be created with marked differences on it.

It is possible to ignore certain areas of the document pages during visual comparison. This is useful for example in case if documents should be the same except certain page area with date on it. In this case, in the folder specified by the outPath, new pdf documents will be created with the black rectangles at the specified ignored areas, and visual comparison will be performed on these new documents.

CompareXmls(byte[], byte[])

Utility method that provides simple comparison of the two xml files stored in byte arrays.

public virtual bool CompareXmls(byte[] xml1, byte[] xml2)

Parameters

xml1 byte[]

first xml file data to compare.

xml2 byte[]

second xml file data to compare.

Returns

bool

true if xml structures are identical, false otherwise.

CompareXmls(string, string)

Utility method that provides simple comparison of the two xml files.

public virtual bool CompareXmls(string outXmlFile, string cmpXmlFile)

Parameters

outXmlFile string

absolute path to the out xml file to compare.

cmpXmlFile string

absolute path to the cmp xml file to compare.

Returns

bool

true if xml structures are identical, false otherwise.

CompareXmp(string, string)

Compares xmp metadata of the two given PDF documents.

public virtual string CompareXmp(string outPdf, string cmpPdf)

Parameters

outPdf string

the absolute path to the output file, which xmp is to be compared to cmp-file.

cmpPdf string

the absolute path to the cmp-file, which xmp is to be compared to output file.

Returns

string

text report on the xmp differences, or null if there are no differences.

CompareXmp(string, string, bool)

Compares xmp metadata of the two given PDF documents.

public virtual string CompareXmp(string outPdf, string cmpPdf, bool ignoreDateAndProducerProperties)

Parameters

outPdf string

the absolute path to the output file, which xmp is to be compared to cmp-file.

cmpPdf string

the absolute path to the cmp-file, which xmp is to be compared to output file.

ignoreDateAndProducerProperties bool

true, if to ignore differences in date or producer xmp metadata properties.

Returns

string

text report on the xmp differences, or null if there are no differences.

ConvertDocInfoToStrings(PdfDocumentInfo)

Converts document info into a string array.

protected virtual string[] ConvertDocInfoToStrings(PdfDocumentInfo info)

Parameters

info PdfDocumentInfo

an instance of PdfDocumentInfo to be converted.

Returns

string[]

String array with all the document info tester is interested in.

Remarks

Converts document info into a string array.

Converts document info into a string array. It can be used to compare PdfDocumentInfo later on. Default implementation retrieves title, author, subject, keywords and producer.

CreateOutputReader(string)

Create PdfReader out of the data created recently or read from disk.

public static PdfReader CreateOutputReader(string filename)

Parameters

filename string

File to read the data from when necessary.

Returns

PdfReader

PdfReader to be used in tests.

CreateOutputReader(string, ReaderProperties)

Create PdfReader out of the data created recently or read from disk.

public static PdfReader CreateOutputReader(string filename, ReaderProperties properties)

Parameters

filename string

File to read the data from when necessary.

properties ReaderProperties

ReaderProperties to use.

Returns

PdfReader

PdfReader to be used in tests.

CreateTestPdfWriter(string)

Create PdfWriter optimized for tests.

public static PdfWriter CreateTestPdfWriter(string filename)

Parameters

filename string

File to write to when necessary.

Returns

PdfWriter

PdfWriter to be used in tests.

CreateTestPdfWriter(string, WriterProperties)

Create PdfWriter optimized for tests.

public static PdfWriter CreateTestPdfWriter(string filename, WriterProperties properties)

Parameters

filename string

File to write to when necessary.

properties WriterProperties

WriterProperties to use.

Returns

PdfWriter

PdfWriter to be used in tests.

DisableCachedPagesComparison()

Disables the default logic of pages comparison.

public virtual CompareTool DisableCachedPagesComparison()

Returns

CompareTool

this CompareTool instance.

Remarks

Disables the default logic of pages comparison. This option makes sense only for CompareByCatalog(PdfDocument, PdfDocument) method.

By default, pages are treated as special objects and if they are met in the process of comparison, then they are not checked as objects, but rather simply checked that they have same page numbers in both documents. This behaviour is intended for the CompareByContent(string, string, string) set of methods, because in them documents are compared in page by page basis. Thus, we don't need to check if pages are of the same content when they are met in comparison process, we are sure that we will compare their content or we have already compared them.

However, if you would use CompareByCatalog(PdfDocument, PdfDocument) with default behaviour of pages comparison, pages won't be checked at all, every time when reference to the page dictionary is met, only page numbers will be compared for both documents. You can say that in this case, comparison will be performed for all document's catalog entries except /Pages (However in fact, document's page tree structures will be compared, but pages themselves - won't).

EnableEncryptionCompare()

Enables the comparison of the encryption properties of the documents.

public virtual CompareTool EnableEncryptionCompare()

Returns

CompareTool

this CompareTool instance.

Remarks

Enables the comparison of the encryption properties of the documents. Encryption properties comparison results are returned along with all other comparison results.

IMPORTANT NOTE: this flag affects only the comparison performed by compareByContent methods! CompareByCatalog(PdfDocument, PdfDocument) doesn't compare encryption properties because encryption properties aren't part of the document's Catalog.

GetCmpReaderProperties()

Gets ReaderProperties to be passed later to the PdfReader of the cmp document.

public virtual ReaderProperties GetCmpReaderProperties()

Returns

ReaderProperties

ReaderProperties instance to be passed later to the PdfReader of the cmp document.

Remarks

Gets ReaderProperties to be passed later to the PdfReader of the cmp document.

Documents for comparison are opened in reader mode. This method is intended to alter ReaderProperties which are used to open the cmp document. This is particularly useful for comparison of encrypted documents.

For more explanations about what outDoc and cmpDoc are see last paragraph of the CompareTool class description.

GetOutReaderProperties()

Gets ReaderProperties to be passed later to the PdfReader of the output document.

public virtual ReaderProperties GetOutReaderProperties()

Returns

ReaderProperties

ReaderProperties instance to be passed later to the PdfReader of the output document.

Remarks

Gets ReaderProperties to be passed later to the PdfReader of the output document.

Documents for comparison are opened in reader mode. This method is intended to alter ReaderProperties which are used to open the output document. This is particularly useful for comparison of encrypted documents.

For more explanations about what outDoc and cmpDoc are see last paragraph of the CompareTool class description.

SetCompareByContentErrorsLimit(int)

Sets the maximum errors count which will be returned as the result of the comparison.

public virtual CompareTool SetCompareByContentErrorsLimit(int compareByContentMaxErrorCount)

Parameters

compareByContentMaxErrorCount int

the errors count.

Returns

CompareTool

this CompareTool instance.

SetEventCountingMetaInfo(IMetaInfo)

Sets iText.Commons.Actions.Contexts.IMetaInfo info that will be used for both read and written documents creation.

public virtual void SetEventCountingMetaInfo(IMetaInfo metaInfo)

Parameters

metaInfo IMetaInfo

meta info to set

SetGenerateCompareByContentXmlReport(bool)

Enables or disables the generation of the comparison report in the form of an xml document.

public virtual CompareTool SetGenerateCompareByContentXmlReport(bool generateCompareByContentXmlReport)

Parameters

generateCompareByContentXmlReport bool

true to enable xml report generation, false - to disable.

Returns

CompareTool

this CompareTool instance.

Remarks

Enables or disables the generation of the comparison report in the form of an xml document.

IMPORTANT NOTE: this flag affects only the comparison performed by compareByContent methods!