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 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 TypeMethodDescriptionvoidCalled to indicate that a comparison has finished.voidonInit()Creates the root and the subfolder for the current comparison run.voidsetImageScaleFactor(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.- 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
-
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
-