Suppose I have a PDF and I want to obtain whatever metadata is available for that PDF. What utility should I use?

I find the piece of information I am usually most interested in knowing is the paper size, something that PDF viewers usually don't report. E.g. is the PDF size letter, legal, A4 or something else? But the other information available may be of interest too.


One of the canonical tools for this is pdfinfo, which comes with xpdf, if I recall. Example output:

[0 1017 17:10:17] ~/temp % pdfinfo test.pdf
Creator:        TeX
Producer:       pdfTeX-1.40.14
CreationDate:   Sun May 18 09:53:06 2014
ModDate:        Sun May 18 09:53:06 2014
Tagged:         no
Form:           none
Pages:          1
Encrypted:      no
Page size:      595.276 x 841.89 pts (A4)
Page rot:       0
File size:      19700 bytes
Optimized:      no
PDF version:    1.5
| improve this answer | |
  • 2
    In Debian at least this is part of poppler-utils. I have a file here which pdfinfo reports as 595.2 x 841.44 pts. But this is not reported as A4. What decides to mark it as A4? – Faheem Mitha Jun 29 '14 at 15:30
  • 3
    The names are hardcoded: letter is 612 ± 0.1 x 792 ± 0.1, the magic sizes for DIN/ISO A are (all ±1 pt): 3370.98, 2383.64, 1685.49, 1191.82, 842.74, 595.91, ..., so it seems your page is a tiny bit too narrow for pdfinfo to pick that up. – Ulrich Schwarz Jun 29 '14 at 16:20
  • 1
    I see, the bit of code if ((fabs(w - 612) < 0.1 && fabs(h - 792) < 0.1) || (fabs(w - 792) < 0.1 && fabs(h - 612) < 0.1))? – Faheem Mitha Jun 29 '14 at 16:23
  • 1
    That's letter, the A formats are in the loop with the sqrt(2)s. – Ulrich Schwarz Jun 29 '14 at 16:24

Another utility worth looking into is exiftool. It might not be the right tool in your specific case as it doesn't report any information on the geometry of the document but in general it is probably the most feature-complete tool for inspecting PDF metadata.

Here's an example of a command that will print all available meta information (-a), sorted by groups (-G1):

exiftool -a -G1 "$File"

The official documentation offers an overview of the supported PDF-related tags:

You can install exiftool on Debian/Ubuntu with:

sudo apt-get install libimage-exiftool-perl

If you are more into the GUI side of things you could give my project PDFMtEd a try. It's a set of tools that serve as graphical frontends to exiftool and allow viewing and editing PDF metadata.

Here are a couple of screenshots:

enter image description here

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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