Compare two PDF files using .NET gives "Incorrect Password"

Hi Team,

When i am trying to compare 2 PDF files, it is giving “Incorrect Password” with multiple page PDF document. When I am trying to compare a single page document then resultant PDF is generated but it is empty. Code snippet used is as below, Can you please check, what can be issue ?

string recordedFile = @"…/…/Documents/Document1.pdf";
string FileName = @"…/…/Documents/Document2.pdf";
string resultFile = @"…/…/Compared/Result1.pdf";

using (Comparer comparer = new Comparer(recordedFile))
{
comparer.Add(FileName);

////SaveOptions saveoptions = new SaveOptions();
////saveoptions.Password = “test”;
////CompareOptions compareoptions = new CompareOptions();
////compareoptions.PasswordSaveOption = PasswordSaveOption.;
////comparer.Compare(resultFile, saveoptions);
comparer.Compare(resultFile);
}

We are also exploring Aspose for the same comparison purpose, we would like to have a Word Style comparison where new additions will be indicated in red, deleted text will be striked-off, same text is represented as green. This comparison is of 2 PDF files, similar to versions of same document but additions/deletions from the old file. In aspose, we have found code snippets to compare 2 word documents, which mostly suites our requirement but could not find similar comparison with PDF docs, do you have an example of such comparisons in groupdocs or Aspose please?

Please note that, we have not yet taken Groupdocs Temporary License.

Thanks,
Khaled

1 Like

@Khaled2020

There could be one of the following factors for such an issue:

  • As you are evaluating API without any license, have a look at the API limitations
  • If source, target or both PDF files are password protected, you have to provide right password

However, please share following details and we’ll look into this matter:

  • API version that you are using (e.g. 20.4, 20.7)
  • Source and target PDF files with their right passwords

You can customize changes styles. Please take a look at this documentation article.

hi @atirtahir3

Thanks for the quick response.
Files, which we tried earlier were not password protected, anyways attaching you the sample files. Version we used is 20.7.

Also, please find error screen shot attached.

Thanks,
Khaled
file-sample_150kB.pdf (139.4 KB)
file-example_PDF_500_kB.pdf (458.5 KB)
image_2020_08_11T05_33_49_141Z.png (76.7 KB)

@Khaled2020

We’ve reproduced this issue at our end. Hence, it’s been logged in our internal issue tracking system with ID COMPARISONNET-2421 for further investigation and resolution. As there’s any update, you’ll be notified.

@Khaled2020

This issue is now fixed in API version 20.8.

@atirtahir3 Thanks for the update.

We have downloaded API version 20.8. When we are comparing 2 simple PDF files of 1 page each (same files as above) but unfortunately, it gives us blank document with license error as “Evaluation Only. Created with Aspose.PDF. Copyright 2002-2018 Aspose Pty Ltd.” . (attached)

We are aware that you have option of Temporary License but will it not allow us to compare atleast a single page sample document to check the options without license?
Sorry, but we are stuck up on evaluation of GroupDocs on basic constructs but facing issue, can you please let us know any possibilities on this ?Groupdocscompare.pdf (35.6 KB)

Thanks,
Khaled

@Khaled2020

The PDF files you shared earlier have more than one pages. Please have a look at API evaluation limitations.
Can you please share the paged PDF files that are raising this issue along-with the document comparison code that you wrote?

@atirtahir3

Thanks, We are facing same issue on any file with evaluation version. Anyways, please find attached 2 source files, which has 1 page each and resultant file attached below, please check and let us know details on the issue.

Code snippet, we are using is as given below,

string fileuploadPath = Server.MapPath("~/UploadedFiles");
string _path = “D:\Document view and compare\WebApplication1\WebApplication1\UploadedFiles\source.pdf”;
string _path1 = “D:\Document view and compare\WebApplication1\WebApplication1\UploadedFiles\target.pdf”;
string outputFileName = Path.Combine(fileuploadPath, “Groupdocscompare.pdf”);

                using (Comparer comparer = new Comparer(_path))
                {
                    comparer.Add(_path1);
                    comparer.Compare(outputFileName);
                }

Groupdocscompare.pdf (35.6 KB)
source-1.pdf (44.7 KB)
source-2.pdf (43.0 KB)

@Khaled2020

Yes, this issue is reproduced at our end. We’re now further investigating it, you investigation ticket ID is COMPARISONNET-2457. As there’s any update, we’ll notify you. We’d encourage you to always create a new thread in case of a different issue.

@atirtahir3 Thanks for the update.

We are trying to evaluate basic comparison of 1 page documents and could not get any result till now. Sorry but we have used simple code snippet, not sure if anything incorrect in it. Firstly, it said incorrect password and then it said evaluation version, that is the reason, I did not create a new ticket because issue remains the same from our perspective, which is could not compare a simple document. Hereon, we will try and create a new ticket.

@Khaled2020

No problem, you can create new ticket(s) if you face any further issues.

@atirtahir3 Can you please let us know, if any update on this please?

@Khaled2020

COMPARISONNET-2457 is still under investigation.

The issues you have found earlier (filed as COMPARISONNET-2457) have been fixed in this update. This message was posted using Bugs notification tool by atirtahir3