Package de.redsix.pdfcompare
Interface CompareResult
-
- All Known Implementing Classes:
AbstractCompareResultWithSwap,CompareResultImpl,CompareResultWithExpectedAndActual,CompareResultWithMemoryOverflow,CompareResultWithPageOverflow
public interface CompareResult
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<PageArea>getDifferences()Gives a PageArea, that shows the area of a page, where differences where found.StringgetDifferencesJson()Converts the result of thegetDifferences()method to an exclusions JSON format.intgetNumberOfPages()Gives that total number of pages in the result.Map<Integer,Double>getPageDiffsInPercent()Gives a map of the difference percentages per page.Collection<Integer>getPagesWithDifferences()Gives a collection of all the pages, that have a difference.booleanhasDifferenceInExclusion()Allows to check for differences in excluded areas.booleanhasOnlyActual()Only true, when there was no expected document at all.booleanhasOnlyExpected()Only true, when there was no actual document at all.booleanhasOnlyOneDoc()Shows, whether one of the two document to comapre was missing or unreadable.booleanisEqual()Returns, whether the compared documents are equal or not.booleanisNotEqual()The inverse of isEqual()booleanwriteTo(OutputStream outputStream)Write the result Pdf to an OutputStream.booleanwriteTo(String filename)Write the result Pdf to a file.
-
-
-
Method Detail
-
writeTo
boolean writeTo(String filename)
Write the result Pdf to a file. Warning: This will remove the diffImages from memory! Writing can only be done once. When no diff images are present, nothing is written.- Parameters:
filename- without pdf-Extension- Returns:
- a boolean indicating, whether the comparison is equal. When true, the files are equal.
-
writeTo
boolean writeTo(OutputStream outputStream)
Write the result Pdf to an OutputStream. Warning: This will remove the diffImages from memory! Writing can only be done once. When no diff images are present, nothing is written. The given OutputStream will be closed when this method returns.- Parameters:
outputStream- to write the pdfFile to.- Returns:
- a boolean indicating, whether the comparison is equal. When true, the files are equal.
-
isEqual
boolean isEqual()
Returns, whether the compared documents are equal or not. Documents are also equal, when differences are only in excluded areas.- Returns:
- true, when no differences are found.
-
isNotEqual
boolean isNotEqual()
The inverse of isEqual()- Returns:
- true, when differences are found.
-
hasDifferenceInExclusion
boolean hasDifferenceInExclusion()
Allows to check for differences in excluded areas.- Returns:
- true, when there where differences in excluded areas.
-
hasOnlyExpected
boolean hasOnlyExpected()
Only true, when there was no actual document at all.- Returns:
- true, when the actual document was missing or not readable.
-
hasOnlyActual
boolean hasOnlyActual()
Only true, when there was no expected document at all.- Returns:
- true, when the expected document was missing or not readable.
-
hasOnlyOneDoc
boolean hasOnlyOneDoc()
Shows, whether one of the two document to comapre was missing or unreadable.- Returns:
- true, when only an ectual or an expected document was found or readable, but not both.
-
getNumberOfPages
int getNumberOfPages()
Gives that total number of pages in the result. This includes pages with differences. When the setting addEqualPagesToResult is set to true, the pages without differences are also counted.- Returns:
- total number of pages in the result
-
getDifferences
Collection<PageArea> getDifferences()
Gives a PageArea, that shows the area of a page, where differences where found. There is only one PageArea per page, which contains all differences of the page.- Returns:
- a collection of PageAreas, where differences where found.
-
getDifferencesJson
String getDifferencesJson()
Converts the result of thegetDifferences()method to an exclusions JSON format.- Returns:
- a JSON string with exclusion areas.
-
getPagesWithDifferences
Collection<Integer> getPagesWithDifferences()
Gives a collection of all the pages, that have a difference. The first page of a document is page 1.- Returns:
- collection of page numbers, that have a difference
-
-