DEV Community

Cover image for Compare PDF Files Using The Terminal
Ryan Bevin
Ryan Bevin

Posted on • Updated on

Compare PDF Files Using The Terminal

Pre-reqisites:
You may need to install poppler-utils. Try this first:
apt-get install poppler-utils

If you are still having trouble, try installing the dependancies as well:
sudo apt-get install libnss3-dev libgpgmepp-dev qtbase5-dev libcairo2-dev libboost-dev

This one is short and sweet. Here are the steps:

  1. Convert the first PDF to a text file
    pdftotext example_pdf_one.pdf

  2. Convert the second PDF to a text file
    pdftotext example_pdf_two.pdf

  3. Check the differences between the text files.
    diff example_pdf_one.txt example_pdf_two.txt

And that's all there is to it!

I also have a video demo on how this works: https://youtu.be/VL-wFPESiCc

Top comments (3)

Collapse
 
mteheran profile image
Miguel Teheran

and what are the steps to install pdftotext ? and also a screenshot could be helpful.
This article is very useful pls add more details because many people will be interested.

Collapse
 
rbevin777 profile image
Ryan Bevin

Thanks for the feedback. I used this on ubuntu so it was pre-installed for me. I did some googling and there is a package that you may need to install. I've updated the article and added a link to my video demo to show how it works. Hope this helps!

Collapse
 
mteheran profile image
Miguel Teheran

Amazing thanks!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.