Package com.inet.pdfc.presenter
Class DifferencesPDFPresenter
java.lang.Object
com.inet.pdfc.presenter.BasePresenter
com.inet.pdfc.presenter.ExportPresenter
com.inet.pdfc.presenter.ExportFilePresenter
com.inet.pdfc.presenter.DifferencesPDFPresenter
- All Implemented Interfaces:
NamedExtension
,Cloneable
This presenter creates a complete comparison PDF for any comparison. The PDF contains all pages of both documents
along with a highlighting of all differences. The visual representation is similar to the one of the i-net PDFC GUI.
NOTE: In case you want to redirect the output to a non-file destination, please overwrite the
NOTE: In case you want to redirect the output to a non-file destination, please overwrite the
getExportStream()
method.- Since:
- i-net PDFC 3.0
-
Nested Class Summary
Nested classes/interfaces inherited from class com.inet.pdfc.presenter.ExportFilePresenter
ExportFilePresenter.HasPrintRange
Nested classes/interfaces inherited from class com.inet.pdfc.presenter.BasePresenter
BasePresenter.ERROR_SOURCE
-
Field Summary
Fields inherited from class com.inet.pdfc.presenter.ExportPresenter
PAINT_BOTH, PAINT_LEFT, PAINT_RIGHT
Fields inherited from class com.inet.pdfc.presenter.BasePresenter
LOGGER, MAX_FILENAME_LENGTH
-
Constructor Summary
ModifierConstructorDescriptionprotected
Shortcut to better support spawn for extended classesDifferencesPDFPresenter
(File rootFolder) Creates the presenterDifferencesPDFPresenter
(File target, boolean isFolder) Creates the presenterDifferencesPDFPresenter
(OutputStream customStream) Creates the presenter.
CAUTION: Since only a single stream is passed here, this instance must be used only for a single comparison! -
Method Summary
Modifier and TypeMethodDescriptionprotected OutputStream
Opens an returns an output stream for the result of the currentBasePresenter.getModel()
.protected String
Get the extension of the target fileReturns the UNIQUE name of the extension.void
Creates the actual result PDF Called to indicate that a comparison has finished.void
setPagelayout
(int pageWidth, int pageHeight, int marginLeft, int marginTop, int marginRight, int marginBottom) Set the desired pageLayout for the pdf to render.void
setPassword
(String password) Set the password for the exported filevoid
setReplaceSystemFonts
(boolean replace) Sets whether system font references should be replaced by embedded PDF default fonts.spawn
(boolean spawnWithParent) Creates another presenter of the the same type as the current one.Methods inherited from class com.inet.pdfc.presenter.ExportFilePresenter
applyPrintRange, configure, setExportOnlyOnDifferences, setModel, setPrintRange
Methods inherited from class com.inet.pdfc.presenter.ExportPresenter
createAndSetupPrintPainter, setAddHeaderFooter, setBackgroundColor, setColorprovider, setOverlapAlpha, setPaintOverlap, setPaintSides, setScaleToFitPageHeight
Methods inherited from class com.inet.pdfc.presenter.BasePresenter
canInformUserOnErrors, createExportFilename, detachFromModel, executeImmediately, getDefaultExportName, getLastPresenterException, getModel, getParent, getPresenterExceptions, onClear, onDataUpdate, onError, onFilterChange, onFinish, onInit, onProgressUpdate, setParent
-
Constructor Details
-
DifferencesPDFPresenter
Creates the presenter- Parameters:
rootFolder
- the folder to store the comparison results to.- Throws:
IllegalStateException
- in case there is no 'reporting' plugin available- Since:
- i-net PDFC 3.0
-
DifferencesPDFPresenter
Creates the presenter- Parameters:
target
- the folder or file to store the comparison results to.isFolder
- if the target is a folder or a file- Throws:
IllegalStateException
- in case there is no 'reporting' plugin available- Since:
- i-net PDFC 4.3
-
DifferencesPDFPresenter
Creates the presenter.
CAUTION: Since only a single stream is passed here, this instance must be used only for a single comparison! If used for a batch comparison all created PDFs will be written to this stream without further notice.- Parameters:
customStream
- the stream to export to.- Since:
- i-net PDFC 5.0
-
DifferencesPDFPresenter
Shortcut to better support spawn for extended classes- Throws:
IllegalStateException
- thrown if there is no active 'reporting' plugin available- Since:
- i-net PDFC 4.0
-
-
Method Details
-
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
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
-
getExportStream
Opens an returns an output stream for the result of the currentBasePresenter.getModel()
. The caller of this method will close the stream itself!- Overrides:
getExportStream
in classExportFilePresenter
- Returns:
- the stream to write the current result to
- Throws:
IOException
- thrown in case the stream could not be created
-
onComparisonDone
Creates the actual result PDF 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:
Exception
- thrown in case the processing of the finish step fails- Since:
- i-net PDFC 3.0
-
setPassword
Set the password for the exported file- Parameters:
password
- the pdf password, null or empty for no password- Since:
- i-net PDFC 21.4
-
getExtension
Get the extension of the target file- Specified by:
getExtension
in classExportFilePresenter
- Returns:
- the file extension like .pdf or .png
-
setReplaceSystemFonts
public void setReplaceSystemFonts(boolean replace) Sets whether system font references should be replaced by embedded PDF default fonts. E.g. a reference to a 'Arial' font may not work when displayed on Unix. Since some system fonts are not allowed to be embedded, the export will replace them by PDF default fonts like 'Helvetica'. This may result in visual differences but generates a consistent result for any viewer.- Parameters:
replace
-true
to replace the fonts,false
to use system font references- Since:
- i-net PDFC 22.4
-
setPagelayout
public void setPagelayout(int pageWidth, int pageHeight, int marginLeft, int marginTop, int marginRight, int marginBottom) Set the desired pageLayout for the pdf to render.- Parameters:
pageWidth
- the desired with in px, including margins.pageHeight
- the desired height in px, including margins.marginLeft
- margins to apply on the left side in px.marginTop
- margins to apply on top of the page in px.marginRight
- margins to apply on the right side in px.marginBottom
- margins to apply on the bottom side in px.- Since:
- i-net PDFC 3.0
-