Ghostscript wipes the PDF metadata like author, title, subject
etc. How can I tell ghostscript not to touch the metadata? I invoke it as follows:
gs \
-dBATCH \
-dNOPAUSE \
-sOutputFile=<output_file> \
-sDEVICE=pdfwrite \
-dPDFSETTINGS=/ebook \
<input_file>
Best Answer
Apparently it's not possible to keep the PDF metadata when using ghostscript. Here is a workaround which first saves the metadata to a file using
pdftk
, then compresses the file withghostscript
and finally writes back the metadata also usingpdftk
.Edit: This is a bug in ghostscript, see Bug report and the confirmation that this is not supposed to happen.