Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

I have two PDF files that look the same when viewed or printed, which diff says are binary and differ. How can I find out what the differences are?

I prefer an answer that will run on Mac OS X or on OpenSUSE.

share|improve this question

marked as duplicate by Mokubai, gronostaj, Shekhar, Breakthrough, Nifle Sep 2 '13 at 20:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Since you mention diff I assume you are using some kind of Unix? –  terdon Aug 28 '13 at 17:18
    
Mac OS X, with MacPorts. I found the exiftool part of my answer while I was composing the question, thought I might add that detail in my answer, and then got the message that I can't answer my own question for 8 hours. –  Polyergic Aug 30 '13 at 23:22
    
I can use any answer that will run on Mac OS X or on OpenSUSE, but in the spirit of making answers that are useful for everyone I would welcome answers that only work on other systems. –  Polyergic Aug 30 '13 at 23:27
    
That question appears to be about visible differences, not invisible differences, and asks for a platform-specific solution. –  Polyergic Sep 2 '13 at 0:32

2 Answers 2

For starters, I would try strings on those files and pipe it through grep "rdf" to see what comes up.

strings x.pdf | grep "rdf"
share|improve this answer
    
Please explain why you would do this. The answer you gave is kind of for insiders only. Check out How to Answer. –  user 99572 is fine Aug 28 '13 at 19:24
    
I'm not sure I follow. @Polyergic asked for ways to find differences. If it's something like creation or modification dates embedded in the PDF (rdf metadata), the commands above would find that. Without more context about what we need to find out, it's difficult to give a more specific answer. And I assume that using Acrobat is out of the question. –  Stefan Ludwig Aug 28 '13 at 22:00
    
strings doesn't find differences, it extracts strings. I'd upvote this because it's useful, but apparently my reputation is too low to acknowledge useful-but-incomplete answers on my own question. –  Polyergic Aug 30 '13 at 23:18
    
It would be nice to know that it can be done with Acrobat, but I would not be able to make use of that answer. –  Polyergic Aug 30 '13 at 23:20
up vote 0 down vote accepted

In shells that support Process Substutition (seen in Q317819), diff can be given the output of any command that generates a text representation - for example, exiftool:

diff -u <(exiftool -a -v one.pdf) <(exiftool -a -v two.pdf)

Stefan's suggestion of strings also generates a text representation, and can be used the same way:

diff -u <(strings one.pdf) <(strings two.pdf)

The output from exiftool or strings is relatively readable, but does not represent the entire file. exiftool only shows metadata, and strings only shows excerpts which are 4 or more bytes of valid ASCII text; differences which are neither recognized as metadata or as ASCII strings will not be found. An unreadable but complete text representation can be made with od:

diff -u <(od -vcw one.pdf) <(od -vcw two.pdf)

(If od is not available, an even less readable but still complete text representation can be made with hexdump or hexcat; in MacPorts, the GNU implementation of od my be installed as god. Not all implementations support the same options.)

The apparent best-available method to see all differences and see the meaning of as many differences as possible is to use each of these on the same two files.

I believe every modern desktop OS other than Windows has a shell that supports Process Substitution installed by default; several such shells are available for Windows, but you'll have to jump through some hoops to get them working.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.