Ghostscript PDF Tips
PDF Creation and Manipulation

Basic Usage

Convert PostScript to PDF:
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=fileout.pdf \
Merge/combine PDF and/or PostScript files:
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=fileout.pdf \ filein2.pdf
Extract a page from a PostScript or a PDF document:
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dFirstPage=3 -dLastPage=3 \

Additional Options

PDF optimization level selection options

-dPDFSETTINGS=/screen   (screen-view-only quality, 72 dpi images)
-dPDFSETTINGS=/ebook    (low quality, 150 dpi images)
-dPDFSETTINGS=/printer  (high quality, 300 dpi images)
-dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs)
-dPDFSETTINGS=/default  (almost identical to /screen)

Paper size selection options

-dFIXEDMEDIA (force paper size over the PostScript defined size)

Other options

-r1200 (resolution for pattern fills and fonts converted to bitmaps)
Embedding PDFmarks


Create a file named “pdfmarks” with this content:
[ /Title (Document title)
  /Author (Author name)
  /Subject (Subject description)
  /Keywords (comma, separated, keywords)
  /ModDate (D:20061204092842)
  /CreationDate (D:20061204092842)
  /Creator (application name or creator note)
  /Producer (PDF producer name or note)
  /DOCINFO pdfmark
then combine the file with a PostScript or a PDF file
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=withmarks.pdf \ pdfmarks
You can also add a couple of named destinations to the “pdfmarks” file
[ /Dest /NamedDest1 /Page 1 /View [/XYZ 20 620 1.8] /DEST pdfmark
[ /Dest /NamedDest2 /Page 2 /View [/FitH 15] /DEST pdfmark
or a few bookmarks
[/Count -2 /Dest /NamedDest1 /Title (Preface) /OUT pdfmark
[ /Action /GoTo /Dest /NamedDest1 /Title (Audience) /OUT pdfmark
[ /Action /GoTo /Dest /NamedDest2 /Title (Content) /OUT pdfmark
[/Count 3 /Page 2 /View [/XYZ 10 160 1.0] /Title (Part 1) /OUT pdfmark
[ /Page 2 /View [/XYZ 10 160 1.0] /Title (A first one) /OUT pdfmark
[ /Page 3 /View [/XYZ 0 500 NULL] /Title (The second one) /OUT pdfmark
[ /Page 6 /View [/FitH 220] /Title (The third thing) /OUT pdfmark
[ /PageMode /UseOutlines /DOCVIEW pdfmark
For more information about pdfmarks see pdfmark Reference Manual.
Embedding Computer Modern Fonts

Type 1 Fonts for LyX/LaTeX/Tex Users

Tex/LaTeX generated PostScript files utilize Type 3 Computer Modern fonts, which are installed by default. Type 3 fonts render good results on high-resolution printers, but look fuzzy on computer displays and thermal printers. On the other hand, Type 1 fonts are scalable, look great on any screen and provide the highest possible quality printout on all kinds of printers.

CM-Super package, which contains Type 1 Computer Modern font, is freely available from CTAN’s Comprehensive TeX Archive. However, most GNU/Linux distributions already provide cm-super package from their default package repositories, just use the distributions’ default package management system to install the package. When creating PDF files, GhostScript and pdfTeX will embed Type 1 fonts if they are available, otherwise they will use Type 3 fonts.


Debian Conference in Portland, Oregon

Nina Paley tribute to EFF

Creative Commons License