Package com.inet.pdfc.presenter
Class DifferencesImagePresenter
- java.lang.Object
-
- com.inet.pdfc.presenter.BasePresenter
-
- com.inet.pdfc.presenter.DifferencesImagePresenter
-
- All Implemented Interfaces:
NamedExtension
public class DifferencesImagePresenter extends BasePresenter
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 Modifier and Type Class Description static class
DifferencesImagePresenter.IMAGE_CONFIG
Deprecated.As of i-net PDFC 5.0-
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
Constructors Constructor Description DifferencesImagePresenter()
Creates a difference image presenter.DifferencesImagePresenter(java.io.File rootFolder)
Creates a difference image presenter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DifferencesImagePresenter
configure(IProfile profile)
Configures the presenter according to a profile.static DifferencesImagePresenter.IMAGE_CONFIG
getConfigSetting(IProfile config)
Deprecated.As of i-net PDFC 5.0 , the property will be stored in settingsSettings.EXPORT.CREATE_DIFFIMAGES_FIRST
andSettings.EXPORT.CREATE_DIFFIMAGES_SECOND
java.lang.String
getExtensionName()
Returns the UNIQUE name of the extension.void
onComparisonDone()
Called to indicate that a comparison has finished.void
onInit()
Creates the root and the subfolder for the current comparison run.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_XORIMAGES
void
setCreatePageImages(boolean createPageImages)
Deprecated.As of i-net PDFC 5.0, use insteadPDFComparer.setSettings(Settings)
->Settings.EXPORT.CREATE_ORIGIMAGES
void
setImageScaleFactor(double scale)
Sets the scale factor for all produced images.
This setter permanently OVERRIDES the values of the profile for this instance!BasePresenter
spawn(boolean spawnWithParent)
Creates another presenter of the the same type as the current one.protected void
writeDifferencesImage(int pageIndex, java.awt.image.BufferedImage targetImg)
Writes a differences image.protected void
writePageImage(int pageIndex, boolean isFirstPDF, java.awt.image.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 Detail
-
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
public DifferencesImagePresenter(java.io.File rootFolder)
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 Detail
-
getExtensionName
public java.lang.String getExtensionName()
Returns the UNIQUE name of the extension. With UNIQUE referring to 'unique among all implementations of the same interface'- Returns:
- the UNIQUE name of the extension
-
spawn
public BasePresenter spawn(boolean spawnWithParent)
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:
spawn
in 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
public DifferencesImagePresenter configure(IProfile profile)
Configures the presenter according to a profile. The presenter will read the propertyPDFCProperty.IMAGE_SCALE_FACTOR
from the profile.- Overrides:
configure
in 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_XORIMAGES
Sets 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 public void setCreatePageImages(boolean createPageImages)
Deprecated.As of i-net PDFC 5.0, use insteadPDFComparer.setSettings(Settings)
->Settings.EXPORT.CREATE_ORIGIMAGES
Enables or disables the output of plain page images. This setter permanently OVERRIDES the values of the profile for this instance!- Parameters:
createPageImages
-true
to 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:
java.lang.IllegalArgumentException
- if scale is <= 0- Since:
- i-net PDFC 3.0
-
onInit
public void onInit() throws java.lang.Exception
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:
onInit
in classBasePresenter
- Throws:
java.lang.Exception
- not thrown in this implementationjava.io.IOException
- in case the destination folder cannot be accessed or created- Since:
- i-net PDFC 3.0
-
onComparisonDone
public void onComparisonDone() throws java.lang.Exception
Called to indicate that a comparison has finished. This does not imply that any page data or differences are available.- Specified by:
onComparisonDone
in classBasePresenter
- Throws:
java.lang.Exception
- thrown in case the processing of the finish step fails- Since:
- i-net PDFC 3.0
-
writeDifferencesImage
protected void writeDifferencesImage(int pageIndex, java.awt.image.BufferedImage targetImg)
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
protected void writePageImage(int pageIndex, boolean isFirstPDF, java.awt.image.BufferedImage pageImage)
Writes the image of a rendered page. This method will be called for any page in either document if the propertyPDFCProperty.CREATE_ORIGIMAGES
is 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 public static DifferencesImagePresenter.IMAGE_CONFIG getConfigSetting(IProfile config)
Deprecated.As of i-net PDFC 5.0 , the property will be stored in settingsSettings.EXPORT.CREATE_DIFFIMAGES_FIRST
andSettings.EXPORT.CREATE_DIFFIMAGES_SECOND
Returns 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
-
-