red6 / pdfcompare

A simple Java library to compare two PDF files
Apache License 2.0
220 stars 66 forks source link

Can't get difference PDF #71

Closed inviul closed 4 years ago

inviul commented 4 years ago

We are using this tool to compare some of the PDF reports in our organization. For some of the PDFs, we can't get the difference output.

I am very thankful to the person who has created this awesome tool, if you look into this issue then it will solve my major problems. I am current using v1.1.45.

finsterwalder commented 4 years ago

In this general form it's hard to say. My first idea is: Are fonts embedded? I assume it's the same PDFs that don't produce a difference output? Can you provide an example PDF, that does not work properly? Maybe also via private email?

inviul commented 4 years ago

Yes, everything looks good. @finsterwalder I am very sorry, I am unable to share the PDF as PDF contains some sensitive data.

Additionally, in another case, diff PDF properly generated by red6/pdfcompare, but we are unable to open the PDF. The file size is also proper, not 0 KB. Can you please guide me on this issue as well?

finsterwalder commented 4 years ago

I'm not sure I understand your problem fully. So I will write up some questions to verify some things.

  1. Is the error consistent? So when you compare the same PDFs, you always get the same result? Or is the error flaky? When you compare the same PDFs, you sometimes get a working difference PDF and sometimes a broken one?

  2. Do you see any (suspicious) Log output? You could also increase PdfBox log output to diagnose more problems.

  3. Are you using a CompareResultWith...Overflow?

  4. Could you generate a PDF without sensitive information, that shows the problem? Or remove the sensitive information from a PDF and check, whether it still causes the problem?

In the past we had some threading issues. Just to be sure, you could try to disable threading and execute in a single thread. For that you need to set "parallelProcessing=false" in the application.conf file or use new PdfComparator(...).withEnvironment(new SimpleEnvironment().setParallelProcessing(false))

finsterwalder commented 4 years ago

Do you need further support? Or did you solve the issue?