Jon (j_b) wrote,

How to unpack / inflate PDF FlateDecode sections

If you're trying to get at data inside a .PDF but it's in one of the FlateDecode subsections, you can unpack it using GNU GhostScript and the included PostScript program

The script that does the work is part of the "toolbin" set of programs in the project's source code - unfortunately Ubuntu 10.4 doesn't ship that component with their packaged version of Ghostscript.

You can download the utility from the project's source repository here:;a=blob_plain;f=gs/toolbin/;hb=HEAD (updated 2011-02-20);a=blob_plain;f=gs/toolbin/;hb=master (updated 2011-05-16 - Vielen Dank to anon commenter from Darmstadt :)

(the "View raw file" is what you want if you're saving it off).


$ gs -- source.pdf output.pdf

Thanks to Ching-Lan Huang of DigDog Software for the info.

Other tools that achieve this:
  • QPDF: qpdf --qdf --object-streams=disable in.pdf out.pdf
  • mupdf-tools: pdfclean -d in.pdf out.pdf
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.