Class PDFComparer
This is the main entry point when using i-net PDFC API. The PDFComparer can compare two files or folders and allows the user to add presenters to show the result.
Inherited Members
Namespace: inetsoftware.Pdfc
Assembly: inetsoftware.Pdfc.dll
Syntax
public class PDFComparer : BridgedObject
Examples
Typical Usage:
IDictionary<string,string> profile = new Dictionary<string, string>();
profile[PDFCProperty.COMPARE_TYPES] = "TEXT";
PDFComparer comparer = new PDFComparer();
comparer.SetProfile( profile );
comparer.AddPresenter( new ConsolePresenter() );
comparer.Compare( "file1.pdf", "file2.pdf" )
Constructors
PDFComparer()
Creates an empty comparer instance.
Declaration
public PDFComparer()
Methods
AddPresenter(BasePresenter)
Adds a Presenter to this instance. A presenter is responsible to 'present' the comparison result, like print found differences on the console or create difference images.
Declaration
public PDFComparer AddPresenter(BasePresenter presenter)
Parameters
Type | Name | Description |
---|---|---|
Base |
presenter | The presenter to add, must not be null. |
Returns
Type | Description |
---|---|
PDFComparer | This comparer for a builder pattern. |
BatchCompare(String, String)
Compare the two given directories located on the file system. Always comparing with the same filename. At least one presenter must registered for BatchCompare because it does not return a result object!
Declaration
public void BatchCompare(string directory1, string directory2)
Parameters
Type | Name | Description |
---|---|---|
System. |
directory1 | The first directory with documents to compare, make sure to have reader plugin for the type of document |
System. |
directory2 | The second directory with documents to compare, make sure to have reader plugin for the type of document |
Compare(String, Byte[], String, Byte[])
Compare the content of two given documents asynchronously. This method call is not blocking. Calls to the ResultModel will block until the comparison has finished.
Declaration
public ResultModel Compare(string name1, byte[] content1, string name2, byte[] content2)
Parameters
Type | Name | Description |
---|---|---|
System. |
name1 | The first document name for logging and error messages. |
System. |
content1 | The content of the first document. |
System. |
name2 | The second document name for logging and error messages. |
System. |
content2 | The content of the second document. |
Returns
Type | Description |
---|---|
Result |
A ResultModel containing result-information about the comparison. |
Compare(String, String)
Compare the two given files located on the file system asynchronously. This method call is not blocking. Calls to the ResultModel will block until the comparison has finished.
Declaration
public ResultModel Compare(string file1, string file2)
Parameters
Type | Name | Description |
---|---|---|
System. |
file1 | The first document to compare, make sure to have reader plugin for the type of document |
System. |
file2 | The second document to compare, make sure to have reader plugin for the type of document |
Returns
Type | Description |
---|---|
Result |
A ResultModel containing result-information about the comparison. |
GetPresenterExceptions()
Return the last exception for the presenter.
Declaration
public PresenterExceptionData[] GetPresenterExceptions()
Returns
Type | Description |
---|---|
Presenter |
The last exception of the presenter |
LoadProfile(String)
Load a profile from an XML file and set it in this comparer.
Declaration
public PDFComparer LoadProfile(string profileFile)
Parameters
Type | Name | Description |
---|---|---|
System. |
profileFile | The file name |
Returns
Type | Description |
---|---|
PDFComparer | This comparer for a builder pattern. |
SetProfile(IDictionary<String, String>)
Set PDFC profile properties.
Declaration
public PDFComparer SetProfile(IDictionary<string, string> profile)
Parameters
Type | Name | Description |
---|---|---|
System. |
profile | The key/values of the profile |
Returns
Type | Description |
---|---|
PDFComparer | This comparer for a builder pattern. |
See Also
SetProfile(String)
Set a default profile with its ID.
Declaration
public PDFComparer SetProfile(string profile)
Parameters
Type | Name | Description |
---|---|---|
System. |
profile | The ID of an existing profile. |
Returns
Type | Description |
---|---|
PDFComparer | This comparer for a builder pattern. |
See Also
SetSettings(IDictionary<String, String>)
Set PDFC setting for visibility output.
Declaration
public PDFComparer SetSettings(IDictionary<string, string> setting)
Parameters
Type | Name | Description |
---|---|---|
System. |
setting | The key/values of the setting |
Returns
Type | Description |
---|---|
PDFComparer | This comparer for a builder pattern. |