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

Error | Production Monkeys

Error

The website encountered an unexpected error. Please try again later.

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/websites/dwadson.com/htdocs/drupal-7.32/includes/common.inc:2694) in drupal_send_headers() (line 1224 of /var/websites/dwadson.com/htdocs/drupal-7.32/includes/bootstrap.inc).
  • PDOException: SQLSTATE[HY000]: General error: 145 Table './productionmonkeys/watchdog' is marked as crashed and should be repaired: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => cron [:db_insert_placeholder_2] => %type: !message in %function (line %line of %file). [:db_insert_placeholder_3] => a:6:{s:5:"%type";s:12:"PDOException";s:8:"!message";s:215:"SQLSTATE[HY000]: General error: 145 Table &#039;./productionmonkeys/watchdog&#039; is marked as crashed and should be repaired: SELECT w.wid AS wid FROM {watchdog} w ORDER BY wid DESC LIMIT 1 OFFSET 999; Array ( ) ";s:9:"%function";s:12:"dblog_cron()";s:5:"%file";s:71:"/var/websites/dwadson.com/htdocs/drupal-7.32/modules/dblog/dblog.module";s:5:"%line";i:113;s:14:"severity_level";i:3;} [:db_insert_placeholder_4] => 3 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://www.productionmonkeys.net/guides/ghostscript/examples [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => 192.168.0.104 [:db_insert_placeholder_9] => 1462305845 ) in dblog_watchdog() (line 160 of /var/websites/dwadson.com/htdocs/drupal-7.32/modules/dblog/dblog.module).