Question

Compare pdf-files in document management

  • 10 December 2019
  • 9 replies
  • 524 views

Userlevel 6
Badge +14

Hi all,

We receive a lot files from our customers. CAD-files for use in the production and a corresponding pdf- file for printing.

When it is a new revision of a file already in our system we would like to compare the pdf- files visual. Something AI that takes the new file, compare it with the old file and highlight the differences on the screen. E.g. a new hole has been added in the right corner.

Anybody his any experience with this? 


9 replies

Userlevel 7
Badge +21

Would it always be a new preliminary version against the last released version? There are (via coding) ways to export the two versions and then opening them manually to check the differences. It still will mean a lot of manual actions. Maybe https://www.diffchecker.com/pdf-diff can be of help?

Userlevel 6
Badge +14

I imaging this solution:

  • Receive pdf drawing through e-mail (Outlook).
  • Connect the mail to a part no in IFS.
  • Right-click ‘Compare files’. 
  • The 2 files are show side by side with the differences highlighted.
  • Do something based on the result. 

I have done some googling. The solutions I have found are not convincing and seems to be focusing on text comparison and not geometry.

Acrobat Pro apparently has a compare function. To be effective, it would have to be integrated with Outlook. I have not checked that jet.

Userlevel 7
Badge +20

Hi @Hans Andersen ,

 

Found this: https://draftable.com/

Seems they have a desktop tool as well as API to compare files. It’s an interesting problem you have and I’d love to know how you solve it

Good luck! :thumbsup:

Userlevel 6
Badge +14

This is the test result from draftable.com (Either it can’t find Wally or it is not suppose to highlight him).

 

Userlevel 7
Badge +20

This is the test result from draftable.com (Either it can’t find Wally or it is not suppose to highlight him).

 

 

 

If you can live without visual compare there could be a workaround instead of a fancy solution.

I’m assuming if there are different content in the files, binary should be different.

Then we can save the file versions as documents in IFS and with your RMB, checks the binary difference (possibly files could convert to base64 and compare?)

 

Cheers!

Userlevel 6
Badge +14

@dsj

It has to be visual and easy to use.

I cannot find any out of the box solution, only some API’s that might be useful.

Getting it to work will probably involve some coding of theses steps:

  1. Fetch a pdf from the disk or email attachment.
  2. Fetch another from IFS document management.
  3. Do the comparison.
  4. Output a bitmap or pdf that shows the differences.

Number 3 is the problem. After some digging,  I found 3 approaches:

  • Use a commercial API. i-net PDFC looks promising. The easiest solution, but will require a license and maintenance.
  • Use Rhino grasshopper. The pdf would have to be converter to 3dm. Rhino is not good at translating text and styling. It could result in false positives.
  • Use ImageMagic. Converting the pdf to bitmap and do pixel comparing.  

Neither is particular appealing.

Userlevel 7
Badge +30

FYI, Oracle AutoVue can do visual comparison of 3D drawings, perhaps 2D too. If it would work with PDF files I cannot say. Perhaps, if they are containing proper vector graphics. Docman has an AutoVue integration but we never got around to activating/using the compare feature and, as it looks now, it AutoVue will be phased our in Aurena. But, it might be something you could look into yourself.

Userlevel 7
Badge +18

This GPL-licensed PowerShell solution could adapted to any .NET language.

  1. Export each of the two PDFs as a raster image
  2. Compute the color differences between the two images
  3. Export the difference as a new raster image

https://github.com/durette/Powershell-Compare-PDF

Userlevel 7
Badge +30

This GPL-licensed PowerShell solution could adapted to any .NET language.

  1. Export each of the two PDFs as a raster image
  2. Compute the color differences between the two images
  3. Export the difference as a new raster image

https://github.com/durette/Powershell-Compare-PDF

Ah, Ghostscript! Those were the days... (before Word could create PDFs I used a VBA/Word macro with GS to create PDF files) Glad to see it’s still alive and kicking!

Thanks for sharing this.

A macro in Docman could easily start a PS script (it could even contain the script itself, and write it to a temporary script file on disk, so that you don't need to keep a copy of the script on each user's PC). A problem here is that we want to compare the files from two different documents or document revisions. A macro can only work in the context of one document/revision. But, if you are willing to have an extra manual step, it could work. First, you would View (or Copy File To...) the first revision. Then you would find the newer revision and View that one. A macro, connected to the VIEW macro process, could then look for the earlier version/revision, pick it up and do the comparison using the PS script.
Time for some hacking, @Hans Andersen! :)

 

Reply