Package com.inet.pdfc.presenter
Class DifferencesImagePresenter
java.lang.Object
com.inet.pdfc.presenter.BasePresenter
com.inet.pdfc.presenter.DifferencesImagePresenter
- All Implemented Interfaces:
com.inet.plugin.NamedExtension
This presenter generates images of all pages as well as side-by-side images of pages with differences.
It's recommended to only use this presenter for strict-mode comparisons as it cannot handle content offsets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDeprecated.As of i-net PDFC 5.0Nested classes/interfaces inherited from class com.inet.pdfc.presenter.BasePresenter
BasePresenter.ERROR_SOURCE -
Field Summary
Fields inherited from class com.inet.pdfc.presenter.BasePresenter
LOGGER, MAX_FILENAME_LENGTH -
Constructor Summary
ConstructorsConstructorDescriptionCreates a difference image presenter.DifferencesImagePresenter(File rootFolder) Creates a difference image presenter. -
Method Summary
Modifier and TypeMethodDescriptionConfigures the presenter according to a profile.getConfigSetting(IProfile config) Deprecated.As of i-net PDFC 5.0 , the property will be stored in settingsSettings.EXPORT.CREATE_DIFFIMAGES_FIRSTandSettings.EXPORT.CREATE_DIFFIMAGES_SECONDvoidCalled to indicate that a comparison has finished.voidonInit()Creates the root and the subfolder for the current comparison run.voidsetCreateDifferenceImages(boolean forFirstDocument, boolean forSecondDocument, boolean xorOfDocuments) Deprecated.As of i-net PDFC 5.0, use insteadPDFComparer.setSettings(Settings)->
Settings.EXPORT.CREATE_DIFFIMAGES_FIRST,
Settings.EXPORT.CREATE_DIFFIMAGES_SECOND,
Settings.EXPORT.CREATE_XORIMAGESvoidsetCreatePageImages(boolean createPageImages) Deprecated.As of i-net PDFC 5.0, use insteadPDFComparer.setSettings(Settings)->Settings.EXPORT.CREATE_ORIGIMAGESvoidsetImageScaleFactor(double scale) Sets the scale factor for all produced images.
This setter permanently OVERRIDES the values of the profile for this instance!spawn(boolean spawnWithParent) Creates another presenter of the the same type as the current one.protected voidwriteDifferencesImage(int pageIndex, BufferedImage targetImg) Writes a differences image.protected voidwritePageImage(int pageIndex, boolean isFirstPDF, BufferedImage pageImage) Writes the image of a rendered page.Methods inherited from class com.inet.pdfc.presenter.BasePresenter
canInformUserOnErrors, createExportFilename, detachFromModel, executeImmediately, getDefaultExportName, getLastPresenterException, getModel, getParent, getPresenterExceptions, onClear, onDataUpdate, onError, onFilterChange, onFinish, onProgressUpdate, setModel, setParent
-
Constructor Details
-
DifferencesImagePresenter
public DifferencesImagePresenter()Creates a difference image presenter. The presenter will write difference and page images according to the configuration into sub folders of the 'differences' folder in the current working directory.
DEFAULT is to print difference images for the first and the second document. To change this, callsetCreateDifferenceImages(boolean, boolean, boolean).- Since:
- i-net PDFC 3.0
-
DifferencesImagePresenter
Creates a difference image presenter. The presenter will write difference and page images according to the configuration into sub folders of the given root folder.- Parameters:
rootFolder- the root folder for all difference folders. must not benull- Since:
- i-net PDFC 3.0
-
-
Method Details
-
getExtensionName
-
spawn
Creates another presenter of the the same type as the current one. The spawned presenter may either have the same settings as the current one or it may be a child of the current one.- Overrides:
spawnin classBasePresenter- Parameters:
spawnWithParent- if true, the presenter is allowed to keep a reference to it's parent to create a summary on onFinish()- Returns:
- a new presenter for the same batch comparison run as the current one
-
configure
Configures the presenter according to a profile. The presenter will read the propertyPDFCProperty.IMAGE_SCALE_FACTORfrom the profile.- Overrides:
configurein classBasePresenter- Parameters:
profile- the profile to read from, must not benull- Returns:
- this instance for concatenation
- Since:
- i-net PDFC 3.0
-
setCreateDifferenceImages
@Deprecated public void setCreateDifferenceImages(boolean forFirstDocument, boolean forSecondDocument, boolean xorOfDocuments) Deprecated.As of i-net PDFC 5.0, use insteadPDFComparer.setSettings(Settings)->
Settings.EXPORT.CREATE_DIFFIMAGES_FIRST,
Settings.EXPORT.CREATE_DIFFIMAGES_SECOND,
Settings.EXPORT.CREATE_XORIMAGESSets what should be content of the differences images per page. This setter permanently OVERRIDES the values of the profile for this instnace!- Parameters:
forFirstDocument- set to include the page of the first documentforSecondDocument- set to include the page of the second documentxorOfDocuments- set to include an XOR-image of the pages pair- Since:
- i-net PDFC 3.0
-
setCreatePageImages
Deprecated.As of i-net PDFC 5.0, use insteadPDFComparer.setSettings(Settings)->Settings.EXPORT.CREATE_ORIGIMAGESEnables or disables the output of plain page images. This setter permanently OVERRIDES the values of the profile for this instance!- Parameters:
createPageImages-trueto enable- Since:
- i-net PDFC 3.0
-
setImageScaleFactor
public void setImageScaleFactor(double scale) Sets the scale factor for all produced images.
This setter permanently OVERRIDES the values of the profile for this instance!- Parameters:
scale- the (positive) scale factor- Throws:
IllegalArgumentException- if scale is <= 0- Since:
- i-net PDFC 3.0
-
onInit
Creates the root and the subfolder for the current comparison run.
IT IS RECOMMENDED TO OVERWRITE THIS METHOD in case the output destination is changed!- Overrides:
onInitin classBasePresenter- Throws:
Exception- not thrown in this implementationIOException- in case the destination folder cannot be accessed or created- Since:
- i-net PDFC 3.0
-
onComparisonDone
Called to indicate that a comparison has finished. This does not imply that any page data or differences are available.- Specified by:
onComparisonDonein classBasePresenter- Throws:
Exception- thrown in case the processing of the finish step fails- Since:
- i-net PDFC 3.0
-
writeDifferencesImage
Writes a differences image. Override this method to implement different storage types, destinations or image encoders.- Parameters:
pageIndex- the zero based index of the page pair presented in the imagetargetImg- the rendered difference image, nevernull- Since:
- i-net PDFC 3.0
-
writePageImage
Writes the image of a rendered page. This method will be called for any page in either document if the propertyPDFCProperty.CREATE_ORIGIMAGESis set to 'true'.- Parameters:
pageIndex- the zero-based index of the pageisFirstPDF- true, if the page belongs to the first document hence falsepageImage- the image of the page, unscaled- Since:
- i-net PDFC 3.0
-
getConfigSetting
Deprecated.As of i-net PDFC 5.0 , the property will be stored in settingsSettings.EXPORT.CREATE_DIFFIMAGES_FIRSTandSettings.EXPORT.CREATE_DIFFIMAGES_SECONDReturns the image paint type as defined by the configuration- Parameters:
config- the configuration to read- Returns:
- the defined image paint type
- Since:
- i-net PDFC 3.0
-