public class PDFComparer
extends java.lang.Object
Typical Usage:
File referenceFile = new File( args[0] ); // first document file File currentFile = new File( args[1] ); // second document file IProfile profile = new DefaultProfile(); profile.putObject( PDFCProperty.CONTINUOUS_COMPARE, Boolean.TRUE ); new PDFComparer().setProfile( profile ).addPresenter( new ConsolePresenter() ).compare( referenceFile, currentFile );
Constructor and Description |
---|
PDFComparer()
Creates an empty comparer instance.
|
Modifier and Type | Method and Description |
---|---|
PDFComparer |
addPresenter(BasePresenter presenter)
Adds a Presenter to this
PDFComparer . |
void |
batchCompare(java.io.File directory1,
java.io.File directory2)
Compare the two given directories, always comparing document files with the same name.
|
void |
batchCompare(DirectoryPdfSource directory1,
DirectoryPdfSource directory2)
Compare the two given directories, always comparing
PdfSources with the same name. |
ResultModel |
compare(java.io.File document1,
java.io.File document2)
Compare the two given PDF-Files located on the file system.
|
ResultModel |
compare(PdfSource pdf1,
PdfSource pdf2)
Compare the two given documents located anywhere.
|
java.util.concurrent.CompletableFuture<ResultModel> |
compareAsync(PdfSource document1,
PdfSource document2)
Asynchronously compares the two given documents.
|
static java.util.List<java.lang.String> |
getAvailableCompareModeKeys()
Returns the keys of all compare modes that are available to the application.
|
static java.util.List<java.lang.String> |
getAvailableFilterKeys()
Returns the keys of all filters that are available to the application.
|
java.util.List<PresenterExceptionData> |
getPresenterExceptions()
Return the exceptions that occurred during the comparison which have not led to an interruption
of the comparison.
|
protected boolean |
isCreateTextSelectionData()
Defines whether the comparer creates the
TextInfoImpl data for the ResultModel as well. |
PDFComparer |
setProfile(IProfile profile)
Set the profile to use with this
PDFComparer . |
PDFComparer |
setProfile(java.lang.String profileID)
Set the profile to use with this
PDFComparer . |
PDFComparer |
setSettings(Settings settings)
Defines the visibility for difference option.
|
void |
setVisibleDifferences(DiffGroup.GroupType... differenceType)
Deprecated.
As of i-net PDFC 4.3, use
setSettings( Settings setting) instead |
void |
setVisibleHighlights(java.lang.String... filterType)
Deprecated.
As of i-net PDFC 4.3, use
setSettings( Settings setting) instead |
public PDFComparer() throws java.lang.RuntimeException, com.inet.pdfc.generator.InvalidLicenseException
setProfile(IProfile)
to configure the comparer,
addPresenter(BasePresenter)
to add output modules and start the comparison with
compare(File, File)
or batchCompare(File, File)
java.lang.RuntimeException
- A runtime exception will be thrown here if and only if there is no valid license which
grants API permissions.com.inet.pdfc.generator.InvalidLicenseException
- thrown in case there is no license for i-net PDFC or, if the license
is insufficient for the API.public PDFComparer setProfile(IProfile profile)
PDFComparer
.profile
- the profile to use, must not be null.PDFComparer
, allowing additional methods to be called in a chain.public PDFComparer setProfile(java.lang.String profileID) throws java.lang.IllegalArgumentException
PDFComparer
.DefaultProfileID.getAvailableProfileIDs()
. All
Available default profiles can be listed by DefaultProfileID.getAvailableProfileIDs()
.profileID
- the ID or name of the profile to be used. Please note, that the names of default profiles are localized, so use their ID instead.PDFComparer
, allowing additional methods to be called in a chain.java.lang.IllegalArgumentException
- thrown if no such profile could be found either by ID or name.DefaultProfileID
public PDFComparer addPresenter(BasePresenter presenter)
PDFComparer
.presenter
- the presenter to add, must not be null.PDFComparer
, allowing additional methods to be called in a chain.ConsolePresenter
,
DifferencesImagePresenter
,
DifferencesPDFPresenter
public ResultModel compare(java.io.File document1, java.io.File document2) throws PdfcException
compareAsync(PdfSource, PdfSource)
for a non-blocking comparison.document1
- the first document to compare, make sure to have reader plugin for the type of documentdocument2
- the second document to compare, make sure to have reader plugin for the type of documentResultModel
containing result-information about the comparison.PdfcException
- when comparison faced an errorjava.lang.IllegalArgumentException
- in case document cannot be accessed or is a directorypublic ResultModel compare(PdfSource pdf1, PdfSource pdf2) throws PdfcException
compareAsync(PdfSource, PdfSource)
for a non-blocking comparison.pdf1
- the first document to compare, make sure to have reader plugin for the type of documentpdf2
- the second document to compare, make sure to have reader plugin for the type of documentResultModel
containing result-information about the comparison.PdfcException
- in case of an internal exceptionpublic void batchCompare(java.io.File directory1, java.io.File directory2)
compareAsync(PdfSource, PdfSource)
for a non-blocking comparison.directory1
- the first directory to use, must be a directory.directory2
- the second directory to use, must be a directory.java.lang.IllegalArgumentException
- thrown in case the directory is not readable or not a directorypublic void batchCompare(DirectoryPdfSource directory1, DirectoryPdfSource directory2)
PdfSources
with the same name.directory1
- the first directory to use, must not be null.directory2
- the second directory to use, must not be null.protected boolean isCreateTextSelectionData()
TextInfoImpl
data for the ResultModel
as well. This data may
require a large amount of memory depending on the text size. It should only be enabled if the protected method
getTextInfos() of the ResultPage
s is used! Otherwise it's awaste of performance and memory.false
by default@Deprecated public void setVisibleDifferences(DiffGroup.GroupType... differenceType)
setSettings( Settings setting)
insteadResultModel.setVisible(boolean, VisibilitySetting...)
method.DiffGroup.GroupType.Sync
will be ignored
here, as they are internal and to not map to a real differences type.differenceType
- the types to set visible; any type which is not in this list will be hidden@Deprecated public void setVisibleHighlights(java.lang.String... filterType)
setSettings( Settings setting)
insteadfilterType
- the filters to activate the highlights for.public PDFComparer setSettings(Settings settings)
settings
- the filters to activate the highlights for.PDFComparer
, allowing additional methods to be called in a chain.public java.util.concurrent.CompletableFuture<ResultModel> compareAsync(PdfSource document1, PdfSource document2)
document1
- the first document to compare, make sure to have reader plugin for the type of documentdocument2
- the second document to compare, make sure to have reader plugin for the type of documentjava.lang.IllegalStateException
- if the same comparer is used to start several async comparisonspublic static java.util.List<java.lang.String> getAvailableCompareModeKeys()
PDFCProperty.CONTINUOUS_COMPARE
property.public static java.util.List<java.lang.String> getAvailableFilterKeys()
PDFCProperty.FILTERS
property.
public java.util.List<PresenterExceptionData> getPresenterExceptions()
Copyright © 2010-2022 by i-net software GmbH