How to open PDF raw?

我的未来我决定 提交于 2019-11-29 22:52:05
Oswald

Use a Hex editor. Of course, unless you know the PDF specification (PDF, 8.6 MB), you won't recognize much.

Looking at the raw code of PDFs will not serve you much unless you also have an idea about its internal structure. You should get yourself a copy of the official PDF reference (download PDF), and you should have read some introductionary article such as this [gone] or this to begin with.

Even after such a preparation, you'll not discover much useful when staring at the raw code. Because PDFs usually will contain parts which are "filtered" (that means: compressed).

How to look at the real PDF source behind the 'raw' binary parts

Jay Birkenbilt's qpdf is a very useful commandline tool (available for Linux, Mac OSX and as source code, under the open source Artistic License), which can unpack most filtered content and re-organize the internal structure in a way that gives you much more insight into it (all objects are numerically ordered, etc.). The commandline to achieve this is:

 qpdf  --qdf  original.pdf  unpacked.pdf

Another useful and free tool (GPL licensed, but Linux-only AFAIK) to look into PDFs is of course PDFEdit. This one even comes with a GUI (if you prefer that), while still allowing you access to the internal structure and "raw" PDF code.

It is very easy to investigate a PDF file source using CosEdit utility. The free version allows to look at sources but not edit them.

In addition to the qpdf tool conversion into postscript might be helpful. PDF is a subset of PS. Usually its quite easy to figure out, e.g. where the labels of a graph are. You can either use pdf2ps or invoke ghostscript

gs -sDEVICE=pswrite some.pdf -sOutputFile=some.ps -dNOPAUSE -c quit

When you generate your PDFs using pdflatex you can disable compression with an option. This makes the PDF more readable.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!