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
,java.lang.Cloneable
public class DifferencesPDFPresenter extends ExportFilePresenter
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 thegetExportStream()
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
Constructors Modifier Constructor Description protected
DifferencesPDFPresenter()
Shortcut to better support spawn for extended classesDifferencesPDFPresenter(java.io.File rootFolder)
Creates the presenterDifferencesPDFPresenter(java.io.File target, boolean isFolder)
Creates the presenterDifferencesPDFPresenter(java.io.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.io.OutputStream
getExportStream()
Opens an returns an output stream for the result of the currentBasePresenter.getModel()
.protected java.lang.String
getExtension()
Get the extension of the target filejava.lang.String
getExtensionName()
Returns the UNIQUE name of the extension.void
onComparisonDone()
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(java.lang.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.BasePresenter
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 Detail
-
DifferencesPDFPresenter
public DifferencesPDFPresenter(java.io.File rootFolder)
Creates the presenter- Parameters:
rootFolder
- the folder to store the comparison results to.- Throws:
java.lang.IllegalStateException
- in case there is no 'reporting' plugin available- Since:
- i-net PDFC 3.0
-
DifferencesPDFPresenter
public DifferencesPDFPresenter(java.io.File target, boolean isFolder)
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:
java.lang.IllegalStateException
- in case there is no 'reporting' plugin available- Since:
- i-net PDFC 4.3
-
DifferencesPDFPresenter
public DifferencesPDFPresenter(java.io.OutputStream customStream)
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
protected DifferencesPDFPresenter() throws java.lang.IllegalStateException
Shortcut to better support spawn for extended classes- Throws:
java.lang.IllegalStateException
- thrown if there is no active 'reporting' plugin available- Since:
- i-net PDFC 4.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
-
getExportStream
protected java.io.OutputStream getExportStream() throws java.io.IOException
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:
java.io.IOException
- thrown in case the stream could not be created
-
onComparisonDone
public void onComparisonDone() throws java.lang.Exception
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:
java.lang.Exception
- thrown in case the processing of the finish step fails- Since:
- i-net PDFC 3.0
-
setPassword
public void setPassword(java.lang.String password)
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
protected java.lang.String 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
-
-