|
Generated by JDiff |
||||||||
| PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES | |||||||||
This file contains all the changes in documentation in the packagecom.itextpdf.kernel.utilsas colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a tag will cause all subsequent paragraphs to be displayed differently.
This class provides means to compare two PDF files both by content and visually and gives the reportofon 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 "gsExec" and "compareExec", which would contain the paths to the executables of correspondingly 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.
Creates new empty instance of CompareResult with given limit of difference messages. @param messageLimit maximum number of difference messages to be handled by this CompareResult.Class CompareTool.CompareResult, Map
Returns map with ObjectPath as keys and difference descriptions as values. @return differences map which could be used to find in the document the objects that are different.Class CompareTool.CompareResult, int getErrorCount()
Returns number of differences between two documentsClass CompareTool.CompareResult, String getReport()metdetected during comparison. @return number of differences.
Converts this CompareResult into text form. @return text reportClass CompareTool.CompareResult, boolean isOk()ofon the differences between two documents.
IsVerifiesused to defineif documents are considered equal after comparison. @return true if documents are equal, false otherwise.
Class that helps to find two corresponding objects in theClass CompareTool.ObjectPath, ObjectPath resetDirectPath(PdfIndirectReference, PdfIndirectReference)comparingcompared documents and also keeps track of the already metinduring comparing process parent indirect objects.You could say that ObjectPath instance consists of two parts: direct path and indirect path. Direct path defines path to the currently comparing objects in relation to base objects. It could be empty, which would mean that currently comparing objects are base objects themselves. Base objects are the two indirect objects from the comparing documents which are in the same position in the pdf trees. Another part, indirect path, defines which indirect objects were met during comparison process to get to the current base objects. Indirect path is needed to avoid infinite loops during comparison.
Creates a new ObjectPath instance with two new given base objects, which are supposed to be nested in the base objects of the current instance of the ObjectPath. This method is used to avoid infinite loop in case of circular references in pdf documents objects structure.Basically, this method creates copy of the current ObjectPath instance, but resets information of the direct paths, and also adds current ObjectPath instance base objects to the indirect references chain that denotes a path to the new base objects. @param baseCmpObject new base object in cmp document. @param baseOutObject new base object in out document. @return new ObjectPath instance, which stores chain of the indirect references which were already met to get to the new base objects.
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.Class CompareTool, String compareByContent(String, String, String)The main difference between this method and the .compareByContent(String, String, String, String) methods is the return value. This method returns a CompareResult class instance, which could be used in code,
howeverwhilst 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
isoutDoc and cmpDoc are see last paragraph of the CompareTool class description. @param outDocumenttheaabsolutePdfDocumentpathcorresponding to the output file, which is to be comparedtowith cmp-file. @param cmpDocumenttheaabsolutePdfDocumentpathcorresponding to the cmp-file, which is to be comparedtowith output file. @return the reportofon comparison of two files in the form of the custom classinstance. SeeCompareResultfor more infoinstance. @throwsIOExceptionIOException @see CompareResult
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.Class CompareTool, String compareByContent(String, String, String, String)
Unlike .compareByCatalog(PdfDocument, PdfDocument) this method performs content comparison page by page and doesn't compare the tag structure, acroforms and all other things that doesn't belong to specific pages.When comparison by content is finished, if any differences were found, visual comparison is automatically started. Formore info see .compareVisually(String, String, String, String). Forthis overload, differenceImagePrefix value is generated using diff_%outPdfFileName%_ format.For more explanations about what
isoutPdf and cmpPdf are see last paragraph of the CompareTool class description. @param outPdf the absolute path to the output file, which is to be compared to cmp-file. @param cmpPdf the absolute path to the cmp-file, which is to be compared to output file. @param outPath the absolute path to the folder, which will be used to store image files for visual comparison. @return string containing text reportofon 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. @throws InterruptedException if the current thread is interrupted by another thread while it is waiting for ghostscript or imagemagic processes, then the wait is ended and an InterruptedException is thrown. @throws IOException is thrown if any of the input files are missing or any of the auxiliary files that are created during comparison processwasnweren't possible to be created. @see #compareVisually(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. You can roughly imagine it as depth-first traversal of the two trees that represent pdf objects structure of the documents.Class CompareTool, String compareByContent(String, String, String, String, Map
Unlike .compareByCatalog(PdfDocument, PdfDocument) this method performs content comparison page by page and doesn't compare the tag structure, acroforms and all other things that doesn't belong to specific pages.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
isoutPdf and cmpPdf are see last paragraph of the CompareTool class description. @param outPdf the absolute path to the output file, which is to be compared to cmp-file. @param cmpPdf the absolute path to the cmp-file, which is to be compared to output file. @param outPath the absolute path to the folder, which will be used to store image files for visual comparison. @param differenceImagePrefix file name prefix for image files with marked visual differences if thereisare any; if it's set to null the prefix defaults to diff_%outPdfFileName%_ format. @return string containing text reportofon 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. @throws InterruptedException if the current thread is interrupted by another thread while it is waiting for ghostscript or imagemagic processes, then the wait is ended and an InterruptedException is thrown. @throws IOException is thrown if any of the input files are missing or any of the auxiliary files that are created during comparison processwasnweren't possible to be created. @see #compareVisually(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. You can roughly imagine it as depth-first traversal of the two trees that represent pdf objects structure of the documents.Class CompareTool, String compareByContent(String, String, String, String, Map
Unlike .compareByCatalog(PdfDocument, PdfDocument) this method performs content comparison page by page and doesn't compare the tag structure, acroforms and all other things that doesn't belong to specific pages.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, Map).For more explanations about what
isoutPdf and cmpPdf are see last paragraph of the CompareTool class description. @param outPdf the absolute path to the output file, which is to be compared to cmp-file. @param cmpPdf the absolute path to the cmp-file, which is to be compared to output file. @param outPath the absolute path to the folder, which will be used to store image files for visual comparison. @param differenceImagePrefix file name prefix for image files with marked visual differences if thereisare any; if it's set to null the prefix defaults to diff_%outPdfFileName%_ format. @param ignoredAreas a map with one-based page numbers as keys and lists of ignored rectangles as values. @return string containing text reportofon 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. @throwsInterruptedExceptionInterruptedException if the current thread is interrupted by another thread while it is waiting for ghostscript or imagemagic processes, then the wait is ended and an InterruptedException is thrown. @throws IOException is thrown if any of the input files are missing or any of the auxiliary files that are created during comparison process weren't possible to be created. @see #compareVisually(String, String, String, String)
This method overload is used to compare two encrypted PDF documents. Document passwords are passed with outPass and cmpPass parameters.Class CompareTool, String compareByContent(String, String, String, String, byte[], byte[])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.
Unlike .compareByCatalog(PdfDocument, PdfDocument) this method performs content comparison page by page and doesn't compare the tag structure, acroforms and all other things that doesn't belong to specific pages.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, Map).For more explanations about what
isoutPdf and cmpPdf are see last paragraph of the CompareTool class description. @param outPdf the absolute path to the output file, which is to be compared to cmp-file. @param cmpPdf the absolute path to the cmp-file, which is to be compared to output file. @param outPath the absolute path to the folder, which will be used to store image files for visual comparison. @param differenceImagePrefix file name prefix for image files with marked visual differences if thereisare any; if it's set to null the prefix defaults to diff_%outPdfFileName%_ format. @param ignoredAreas a map with one-based page numbers as keys and lists of ignored rectangles as values. @param outPass password for the encrypted document specified by the outPdf absolute path. @param cmpPass password for the encrypted document specified by the cmpPdf absolute path. @return string containing text reportofon 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. @throws InterruptedException if the current thread is interrupted by another thread while it is waiting for ghostscript or imagemagic processes, then the wait is ended and an InterruptedException is thrown. @throws IOException is thrown if any of the input files are missing or any of the auxiliary files that are created during comparison processwasnweren't possible to be created. @see #compareVisually(String, String, String, String)
This method overload is used to compare two encrypted PDF documents. Document passwords are passed with outPass and cmpPass parameters.Class CompareTool, CompareResult compareDictionariesStructure(PdfDictionary, PdfDictionary)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.
Unlike .compareByCatalog(PdfDocument, PdfDocument) this method performs content comparison page by page and doesn't compare the tag structure, acroforms and all other things that doesn't belong to specific pages.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
isoutPdf and cmpPdf are see last paragraph of the CompareTool class description. @param outPdf the absolute path to the output file, which is to be compared to cmp-file. @param cmpPdf the absolute path to the cmp-file, which is to be compared to output file. @param outPath the absolute path to the folder, which will be used to store image files for visual comparison. @param differenceImagePrefix 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. @param outPass password for the encrypted document specified by the outPdf absolute path. @param cmpPass password for the encrypted document specified by the cmpPdf absolute path. @return string containing text reportofon 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. @throwsInterruptedExceptionInterruptedException if the current thread is interrupted by another thread while it is waiting for ghostscript or imagemagic processes, then the wait is ended and an InterruptedException is thrown. @throws IOException is thrown if any of the input files are missing or any of the auxiliary files that are created during comparison process weren't possible to be created. @see #compareVisually(String, String, String, String)
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.Class CompareTool, CompareResult compareDictionariesStructure(PdfDictionary, PdfDictionary, SetBoth 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
isoutPdf and cmpPdf are see last paragraph of the CompareTool class description. @param outDict an indirect PdfDictionary from the output file, which is to be compared to cmp-file dictionary. @param cmpDict an indirect PdfDictionary from the cmp-file file, which is to be compared to output file dictionary. @return CompareResult instance containing differences between the two dictionaries, or {@code null} if dictionaries are equal.
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.Class CompareTool, String compareDocumentInfo(String, String)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
isoutPdf and cmpPdf are see last paragraph of the CompareTool class description. @param outDict an indirect PdfDictionary from the output file, which is to be compared to cmp-file dictionary. @param cmpDict an indirect PdfDictionary from the cmp-file file, which is to be compared to output file dictionary. @param excludedKeys a Set of names that designate entries from {@code outDict} and {@code cmpDict} dictionaries which are to be skipped during comparison. @return CompareResult instance containing differences between the two dictionaries, or {@code null} if dictionaries are equal.
Compares document info dictionaries of two pdf documents. @param outPdf the absolute path to the output file, which info is to be compared to cmp-file info. @param cmpPdf the absolute path to the cmp-file, which info is to be compared to output file info. @return text reportClass CompareTool, String compareDocumentInfo(String, String, byte[], byte[])ofon the differences in documents infos. @throws IOException
Compares document info dictionaries of two pdf documents.Class CompareTool, String compareLinkAnnotations(String, String)This method overload is used to compare two encrypted PDF documents. Document passwords are passed with outPass and cmpPass parameters.
Compares document info dictionaries of two pdf documents.@param outPdf the absolute path to the output file, which info is to be compared to cmp-file info. @param cmpPdf the absolute path to the cmp-file, which info is to be compared to output file info. @param outPass password for the encrypted document specified by the outPdf absolute path. @param cmpPass password for the encrypted document specified by the cmpPdf absolute path. @return text reportofon the differences in documents infos. @throws IOException
Class CompareTool, String compareTagStructures(String, String)ComparesChecks if two documentshashave identical link annotations on corresponding pages. @param outPdf the absolute path to the output file, which links are to be compared to cmp-file links. @param cmpPdf the absolute path to the cmp-file, which links are to be compared to output file links. @return text reportofon the differences in documents links. @throws IOException
Compares tag structures of the two PDF documents.Class CompareTool, String compareVisually(String, String, String, String)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. @param outPdf the absolute path to the output file, which tags are to be compared to cmp-file tags. @param cmpPdf the absolute path to the cmp-file, which tags are to be compared to output file tags. @return text report of the differences in documents tags. @throws IOException @throws ParserConfigurationException @throws SAXException
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.Class CompareTool, String compareVisually(String, String, String, String, MapDuring comparison for every page of the two documents an image file will be created in the folder specified by outPath
absolute pathparameter. 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. @param outPdf the absolute path to the output file, which is to be compared to cmp-file. @param cmpPdf the absolute path to the cmp-file, which is to be compared to output file. @param outPath the absolute path to the folder, which will be used to store image files for visual comparison. @param differenceImagePrefix file name prefix for image files with marked differences if there is any. @return string containing list of the pages that are visually different, or null if there are no visual differences. @throws InterruptedException @throws IOException
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.Class CompareTool, String compareXmp(String, String)During comparison for every page of two documents an image file will be created in the folder specified by outPath
absolute pathparameter. 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. @param outPdf the absolute path to the output file, which is to be compared to cmp-file. @param cmpPdf the absolute path to the cmp-file, which is to be compared to output file. @param outPath the absolute path to the folder, which will be used to store image files for visual comparison. @param differenceImagePrefix file name prefix for image files with marked differences if there is any. @param ignoredAreas a map with one-based page numbers as keys and lists of ignored rectangles as values. @return string containing list of the pages that are visually different, or null if there are no visual differences. @throws InterruptedException @throws IOException
Compares xmp metadata of the two given PDF documents. @param outPdf the absolute path to the output file, which xmp is to be compared to cmp-file. @param cmpPdf the absolute path to the cmp-file, which xmp is to be compared to output file. @return text reportClass CompareTool, String compareXmp(String, String, boolean)ofon the xmp differences, or null if there are no differences.
Compares xmp metadata of the two given PDF documents. @param outPdf the absolute path to the output file, which xmp is to be compared to cmp-file. @param cmpPdf the absolute path to the cmp-file, which xmp is to be compared to output file. @param ignoreDateAndProducerProperties true, if to ignore differences in date or producer xmp metadata properties. @return text reportClass CompareTool, CompareTool disableCachedPagesComparison()ofon the xmp differences, or null if there are no differences.
Disables the default logic of pages comparison. This option makes sense only for CompareTool.compareByCatalog(PdfDocument, PdfDocument) method.Class CompareTool, CompareTool enableEncryptionCompare()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
hashave same page numbers in both documents. This behaviour is intended for the CompareTool.compareByContent 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 CompareTool.compareByCatalog 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). @return this CompareTool instance.
Enables the comparison of the encryption properties of the documents. Encryption properties comparison results are returned along with all other comparison results.Class CompareTool, ReaderProperties getCmpReaderProperties()IMPORTANT NOTE: this flag
affectaffects only the comparisonmadeperformed by compareByContent methods! .compareByCatalog(PdfDocument, PdfDocument) doesn't compare encryption properties because encryption properties aren't part of the document's Catalog. @return this CompareTool instance.
Gets ReaderProperties to be passed later to the PdfReader of the cmp document.Class CompareTool, ReaderProperties getOutReaderProperties()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
isoutDoc and cmpDoc are see last paragraph of the CompareTool class description. @return ReaderProperties instancewhich willto belaterpassed later to thecmp documentPdfReader of the cmp document.
Gets ReaderProperties to be passed later to the PdfReader of the output document.Class CompareTool, CompareTool setGenerateCompareByContentXmlReport(boolean)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
isoutDoc and cmpDoc are see last paragraph of the CompareTool class description. @return ReaderProperties instancewhich willto belaterpassed later to theoutput documentPdfReader of the output document.
Enables or disables the generation of the comparison report in the form ofthean xml document.IMPORTANT NOTE: this flag
affectaffects only the comparisonmadeperformed by compareByContent methods! @param generateCompareByContentXmlReport true to enable xml report generation, false - to disable. @return this CompareTool instance.