'Converting commented PDF with Ghostscript but without the comments
Gentlepeople,
I'm using the command line version of GhostScript for Windows to convert PDF to PNG images. However I noticed that also the annotations (such as comments, shapes, attached files - anything the user can put on top of the original PDF) were converted and appear in the image output. Is there any way to let Ghostscript ignore comments in PDF?
Your help is appreciated :-)
Solution 1:[1]
I had the same question. I found a setting in GhostScript which turns off comment printing (called annotations in their documentation). http://www.ghostscript.com/doc/current/Use.htm
the switch is -dShowAnnots=false which is case sensitive. For example, to convert a file to PNG (which was also what I wanted to do), you would use something like:
gswin64c -sDEVICE=png16m -sOutputFile="OutFile.png" -r300 -dShowAnnots=false "InputFile.pdf"
Using this command line format gave me exactly what I wanted: The first page of the source PDF converted to true-color PNG format without transparency, at 300 DPI, without any of the comments from the PDF.
Solution 2:[2]
Had this error:
BBox has zero width or height, which is not allowed.
Found this hint, but without solution: https://bugs.ghostscript.com/show_bug.cgi?id=696889
I already used
-dPreserveAnnots=false
but the error came nonetheless.
-dShowAnnots=false fixes it for me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | connectedMind |
