Examples

Usage examples for Ghostscript.

"Normalize" a PDF

gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=output.pdf input.pdf

PDF to EPS
http://pages.cs.wisc.edu/~ghost/doc/svn/Use.htm#Output_device

gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=epswrite -sOutputFile=output.eps input.pdf

-dNOCACHE Prevents it from rasterizing fonts!

PDF Presets

-dPDFSETTINGS=_____

Options are: /screen, /printer, /prepress, /default, /ebook.

Color Conversion
http://vince-debian.blogspot.com/2008/05/pdf-conversion-to-grayscale.html

Color PDF to greyscale:

gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \
-sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray \
-sOutputFile=output.pdf input.pdf

Color PDF to CMYK:

gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \
-sColorConversionStrategy=CMYK -dProcessColorModel=/DeviceCMYK \
-sOutputFile=output.pdf input.pdf

PDF to JPEG

gs -q -dBATCH -dNOPAUSE -dFirstPage=1 -dLastPage=1 -sDEVICE=jpeg \
-r<OUTPUT RESOLUTION> -sOutputFile=<OUTPUT>.jpg <INPUT>.pdf

EPS to a PDF

ps2pdf -dEPSCrop input.eps output.pdf

Color Separations

gs -sDEVICE=tiffsep -dNOPAUSE -dBATCH -dSAFER -r600x600 \
-sOutputFile=p%08d.tif CJ_2011-04-15_A-01-16.pdf

1-bit TIFF for an imagesetter:

gs -sDEVICE=tiffsep1 -dNOPAUSE -dBATCH -dSAFER -r1200x1200 \
-dCOLORSCREEN -dDITHERPPI=85 \
-sOutputFile=CJ_A16-A01_%02d.tif CJ_2011-04-15_A-16-01-CMYK.pdf

Merge the 1-bit TIFF files into a CMYK composite:

convert CJ_A16-A01_01\(Cyan\).tif \
CJ_A16-A01_01\(Magenta\).tif \
CJ_A16-A01_01\(Yellow\).tif \
CJ_A16-A01_01\(Black\).tif \
-set colorspace CMYK -combine combined.tif

TIFF to PDF

tiff2pdf -o cj_a01_Black.pdf cj_a01_01\(Black\).tif

http://www.linuxjournal.com/content/tech-tip-using-ghostscript-convert-and-combine-files

Recent Updates