Quick tip: Decompressing PDFs for Debugging

If you are creating special effects in PDFs (e.g., using pdfTeX’s \pdfliteral{…} or via \special{…}) it can be extremely helpful to see the raw PDF code being output by your code/macros etc – especially when debugging! Often, by default, PDF content streams are compressed/encoded into binary data which makes it extremely difficult to access the raw PDF data/content. However, you can use the recently released free community version of Coherent’s excellent command-line PDF manipulation software to decompress the binary data into plain text. It’s as simple as:

cpdf -decompress compressedfile.pdf -o decompressedfile.pdf

cpdf has a wealth of other interesting command-line options too.