简体   繁体   中英

Ghostscript - Convert PDF to PDF/A

I am using this command on a linux server to convert PDF files to PDF/A and it works correcly:

gs -dPDFA -dNOOUTERSAVE -sProcessColorModel=DeviceRGB -sDEVICE=pdfwrite -o input.pdf -dPDFACompatibilityPolicy=1 output.pdf

The only concern I have is the graphics quality. My initial PDF has 1.5MB and the converted one only 500kb. The graphics quality is reduced.

Any idea on how to preserve quality of the initial pdf?

GHostscript does not 'convert' PDF files to PDF/A. It interprets the input and produces a new PDF file which should be visually the same as the input. But its not the same file in any sense.

Now, if the input file has JPEG images in it, then they will be decoded to the raw bytes. If you haven't changed the default settings then these will be recompressed using DCT (JPEG) compression.

Applying lossy JPEG compression to data which has already been lossily compressed results in degradation in quality (but makes the data smaller of course).

You can control the compression of images, and instead us a lossless compression scheme (such as Flate), this is documented in ps2pdf.htm, search for ColorImageFilter and ColorImageDict.

Note that, assuming you are using an up to date version of Ghostscript, you should not set the ProcessColorModel, this will leave (eg) CMYK colours untouched. You should be using -sColorConversionStrategy=RGB which will also set the ProcessColorModel for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM