WARNING: gs and pdf2ps|ps2pdf DO NOT Flatten PDFs!
Using gs or pdf2ps followed by ps2pdf will yield a multi-layer PDF with the content under annotations present in original form. You can verify this flaw in Preview by using Select All, then Copy, then Paste into a TextEdit window (in rich text mode). You will see the text or graphics under redaction annotations for example. This is clearly very bad if you legally need that content to be gone from the output.
A Working Solution
ImageMagick can produce a configurable quality, multi-page, single-layer flattened PDF with rasters of each page using the following command:
convert -density 150 document_original.pdf document_flat.pdf
This command rasterizes document_original.pdf, making an pixel-based image of each page, at 150 DPI, and outputs the result as document_flat.pdf.
A Note on Image Quality
Due to the rasterization, it produces a non-scalable (zoom and you'll see the text or original vector images become pixellated) PDF. It will likely have a larger filesize unless the original has very complex vector content like million-point scatter plots.
By changing density, you can trade larger file size for higher resolution output.
All text will be converted to raw pixels in each page image. Text and vector diagrams suffer the most, so experiment with the DPI until you get usable output files.
Best Answer
Yes. Qpdf should do what you want:
You can find a download for Windows (assuming you have MinGW installed) if you go to
Files->qpdf->latest version
, then scroll down to find a description of the files (you can find a link to version 5.11, the most recent version as of 2014-3-28, here).Choco users can install the package by issuing
choco install qpdf
(ref)