Free Support Forum - groupdocs.com

PDF comparison returns null using C#

Hi. subscription period 20180827 is your client. I using GroupDocs.Comparison 18.7.1.0
the result was null when I used my license file and the appropriate GroupDocs.Comparison 18.7.1.0
I used the temporary license file and the GroupDocs.Comparison 19.1.0.0. result returned null

my code :

GroupDocs.Comparison.Common.License.License license = new GroupDocs.Comparison.Common.License.License();
using (Stream licenseStream = System.IO.File.Open(@“C:\comp\lic\GroupDocs.Comparison.lic”, FileMode.Open, FileAccess.Read, FileShare.Read))
{
license.SetLicense(licenseStream);
}
GroupDocs.Comparison.Common.ComparisonSettings.ComparisonSettings objComparisonSettings = new GroupDocs.Comparison.Common.ComparisonSettings.ComparisonSettings
{
DeletedItemsStyle = new GroupDocs.Comparison.Common.ComparisonSettings.StyleSettings { StrikeThrough = false, FontColor = System.Drawing.Color.Red, Underline = true/, BeginSeparatorString = “”, EndSeparatorString = “”/ },
InsertedItemsStyle = new GroupDocs.Comparison.Common.ComparisonSettings.StyleSettings { StrikeThrough = false, FontColor = System.Drawing.Color.Green, Underline = false/, BeginSeparatorString = “”, EndSeparatorString = “”/ },
StyleChangedItemsStyle = new GroupDocs.Comparison.Common.ComparisonSettings.StyleSettings { StrikeThrough = false, FontColor = System.Drawing.Color.Blue, Italic = true/*, BeginSeparatorString = “”, EndSeparatorString = “” /},
ShowDeletedContent = true,
StyleChangeDetection = true,
UseFramesForDelInsElements = true,
WordsSeparatorChars = new char[] { '
’ },
CloneMetadata = GroupDocs.Comparison.Common.ComparisonSettings.TypeMetadata.Target,
DetailLevel = GroupDocs.Comparison.Common.ComparisonSettings.DetailLevel.Hight,
GenerateSummaryPage = false,

        };

        GroupDocs.Comparison.Common.ICompareResult compareResult = null;
        GroupDocs.Comparison.Comparer comparer = new GroupDocs.Comparison.Comparer();
        compareResult = comparer.Compare(sourcePath, targetPath, objComparisonSettings);

OrnekPdf.pdf (434.3 KB)
örnekPdf2.pdf (354.8 KB)
result.JPG (43.5 KB)

@NewCustomer,

This issue is not reproduced at our end using 19.1 version of the API with a valid license. Please see the output file attached - output.pdf (1.4 MB)

However, if license is not properly applied/loaded, we get null at compareResult. Make sure that temporary license is valid and loaded properly.

I have shared the license installation above. Where is my mistake

@NewCustomer,

We used your snippet to reproduce the issue. There doesn’t seem to be any issue with the code. But make sure that there is no license file path/directory access restriction (license is easily accessible) and license is valid. You can see if license is applied properly this way - LicenseChecker.png (9.9 KB). LicenseChecker must be true.
For further investigation, please share license file (temporary license that you requested) in a private message with us.

I have sent the license files as a private message. I checked the license and shared it as a picture.

LicenseChecker.jpg (33.2 KB)
Diagnostic Tool Screen (23.6 KB)

@NewCustomer,

We still cannot reproduce this issue using any of the licenses that you shared. Please run this application, copy license file in bin/debug folder.
We investigated this scenario using both API versions (19.1 with temporary license and 18.7.1 with the other one). You can also see the output generated in bin/debug folder.
Let us know if you can successfully compare the documents using the application we shared.

The result was successful but didn’t it last long?dg2.JPG (66.0 KB)

@NewCustomer,

Memory consumption also depends on content of the documents that you are comparing. Please note that documents with more content (pictures, tables, clip arts etc) takes more time and memory.

OK the problem has been solved. Thank you for your help.
Regards

1 Like

@NewCustomer,

You are welcome.

sometimes returns empty is compareResult. continues without error and crashing app

@NewCustomer,

Do you face this scenario using particular (source and target) documents? Can you share those problematic files with us?
Please note that currently you cannot see the error/exception details (if there are any) in (ICompareResult)compareResult, this is already logged in our internal issue tracking system with ID:COMPARISONNET-1773.
But in some upcoming release (19.4 most probably), instead of returning null, API will throw proper exception that could be handled.

I am using the same file and license. Sometimes comparisonResult is return null . Is there a way we can learn how long the comparison is to end? Like the status percentage

@NewCustomer,

This behavior is under investigation ID:COMPARISONNET-1773.

Currently, you cannot track/determine documents comparison progress. However, we have logged a ticket against this feature in our internal issue tracking system with ID : COMPARISONNET-1871. As we have any further update on it, we’ll notify you.