1

I am trying to find any default tool in OS X by which you can see in Terminal the encodinf of a pdf file.

You can do this visually by clicking info on the file.

For instance, such files which have Mac OS X 10.10.2 Quartz PDFContext I want to get out of my System. So my task is actually find those files and then find original ones and convert them correctly to right encoding via LaTeX.

Outputs of the commands in answers

Command mdls in fd0's answer

mdls -name kMDItemEncodingApplications -raw OxfordDictionary.pdf 

gives

(
    "3-Heights(TM) PDF Producer 2.0.5.0 (http://www.pdf-tools.com); modified using iTextSharp 5.0.0 (c) 1T3XT BVBA"

Installation of brew install Caskroom/cask/pdfinfo wants sudo so I had to reject it in my current settings. The mdls seems to work sufficiently.


How can you see the encoding of pdf-file in OS X Terminal?

1

You can use mdls instead of installing external tools.

mdls -name kMDItemEncodingApplications -raw file.pdf
  • Great! Than you for pointing this out. The installation of pdinfo requires sude which does not make sense. I had to reject it in my current setting. I added an example output of your command in the body of the question. Your command seems to work sufficiently. – Léo Léopold Hertz 준영 Feb 15 '16 at 17:10
2

Just get Xpdf 3.04 from foolabs.

If your current system is Yosemite get the precompiled binaries: xpdfbin-mac-3.04. The 64-bit installer available there doesn't work. Uncompress/Untar the tar.gz and install this binary package manually:

  1. Copy the 64-bit executables (xpdf, pdftotext, etc.) to to /usr/local/bin.

  2. Copy the man pages (*.1 and *.5) to /usr/local/man/man1 and /usr/local/man/man5.

  3. Copy the sample-xpdfrc file to /usr/local/etc/xpdfrc. You'll probably want to edit its contents (as distributed, everything is commented out) -- see xpdfrc(5) for details.

Check your $PATH if the executables don't work.

If your current system is Mavericks, Mountain Lion or Lion the above-mentioned 64-bit installer should work.

Now continue like Matteo mentioned:

To extract it with pdfinfo:

pdfinfo file.pdf | grep ^Producer
0

The tool you mention pdfinfo is available on OS X, for example by installing MacPorts and then

sudo port install pdfinfo

About the second part of your question: Mac OS X 10.10.2 Quartz PDFContext is not an encoding but the producer.

To extract it with pdfinfo:

pdfinfo file.pdf | grep ^Producer
  • It would be great if this can be done without external tools. Just with standard tools. – Léo Léopold Hertz 준영 Feb 9 '15 at 16:06
  • But you mentioned pdfinfo yourself... Anyway I don't think that OS X has some similar by default (either by using string and grep ...) – Matteo Feb 9 '15 at 16:10
  • Installed MacPorts -> Error: Port pdfinfo not found – directory Jan 13 '16 at 19:30
  • 1
    You need brew install Caskroom/cask/pdfinfo in El Capitan. – Léo Léopold Hertz 준영 Feb 15 '16 at 17:11
0

If you want to install it using mac ports, you should install the package xpdf OR xpdf-tools, for example:

sudo port install xpdf-tools

and then extract the information you need:

pdfinfo file.pdf | grep ^Producer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .