We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF files generated from the same are slightly different

We generate PDF files using aspose.pdf. If we generate 2 pdf from the same source file, we expect that the resulting pdf will be absolutely the same as binary files.
BUT unfortunately the resulting generated files are slightly different in several bites.
So they have different check-sums, we cannot compare them to identify duplicates, etc.
Is it possible to generate pdf file so, that next time it will be absolutely the same?
Setting the same meta information in DocumentInfo - does not help.

Kindly send us the complete details of the test case, including input files (if any), code snippet and any other handy information. We will investigate and share our findings with you. Your response is awaited.

Best Regards,
Imran Rafique

You can reproduce the same using for instance the following.

  1. Take a very simple PDF file and merge this one file into other one using Aspose.PDF with the colde like this:
    string resultFileName = @“c:\temp\t.pdf”;
    string resultFileName2 = @“c:\temp\t22.pdf”;
    Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(resultFileName);
    Aspose.Pdf.Document pdf1 = new Aspose.Pdf.Document();
    DocumentInfo docInfo1 = pdf1.Info;
    docInfo1.CreationDate = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Local);
    docInfo1.ModDate = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Local);
  2. Rename the resulting file t22.PDF manually into t2.PDF
  3. Run the same code again, you will get t22.PDF
  4. Compare the files: t2.pdf and t22.PDF using binary comparing utility (for example cmp t2.pdf t22.pdf.
    You will see that the files are different in some bytes.
    The question: Can we do something that they would be the same, i.e. t2.pdf = t22.pdf?

We have generated two PDF documents (t2.pdf (101.4 KB)t22.pdf (101.4 KB)) as per your scenario and could find a single difference which is due the unique identifier. Kindly test these PDF documents into your environment, and let us know how that goes in your environment. Your response is awaited.

Best Regards,
Imran Rafiique

Hi Imran
You are confirming that the files are SLIGHTLY different.
Does your answer mean that there is no possibility to generate the files that would be ABSOLUTELY identical?
If not possible, it is a pity and it is a bit a problem that we have to solve.
We will need to invent special algorithm that both generated files that are different as binaries would have the same check-sum.

If you have an idea of easy solution that would help, please let me know, Kind regards, Alex

In order to make PDF files absolutely identical, we have logged an investigation under the ticket ID PDFNET-43153 in our issue tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates. We are sorry the inconvenience caused.

We would recommend you, kindly share the source PDF documents because it will help us to test the actual scenario in our environment.

Best Regards,
Imran Rafique