Hack 42 Configure Distiller and Ghostscript for Your Purpose

figs/moderate.gif figs/hack42.gif

Unlock the secret powers of Distiller and Ghostscript.

Acrobat Distiller creates PDF based on its current profile setting [Hack #38] . On Windows, choose a profile when you print by changing the Print Properties . . . Adobe PDF Settings tab Default Settings drop-down box, as shown in Figure 4-11. On a Macintosh, choose PDF Options from the drop-down box that starts out saying Copies & Pages instead of selecting the Adobe PDF Settings tab. When using Ghostscript, you can reference a joboptions file in pdf_printer.cfg.

Figure 4-11. Choosing PDF printer properties
figs/pdfh_0411.gif


Whenever you print to an Acrobat PDF printer, you can select a profile that creates the best PDF for your purpose. You can view and edit these profiles using the graphical Distiller application. The surprise is that these profiles, or joboptions files, are plain-text PostScript snippets that give you more control over Distiller than the GUI does. They are also compatible with Ghostscript, although Ghostscript does not implement all the possible settings. Indeed, the joboptions file (and its specification) is a good place to get the straight dope on what Distiller and Ghostscript can really do.

4.12.1 Acrobat Distiller Parameters Tell the Full Story

To fully understand Distiller and Ghostscript features, you must read the Acrobat Distiller Parameters document from Adobe. It is also the definitive guide to joboptions file parameters.

If you have Acrobat on your computer, open Distiller and select Help Distiller Parameters Guide, or search your disk for distparm.pdf. On the Macintosh, this file is in the Extras folder on the installer CD. The Acrobat 6 version of distparm.pdf is not available online except to paying Adobe ASN Developer Program members. The next best thing is the Acrobat 5 version, which is bundled with the freely downloadable Acrobat 5 SDK:

http://partners.adobe.com/asn/acrobat/download.jsp

Ghostscript users should also read C:\gs\gs8.14\doc\Ps2pdf.htm or, online:

http://www.cs.wisc.edu/~ghost/doc/cvs/Ps2pdf.htm

If you plan to deliver PDF to a service bureau, find out if they have a joboptions file you should use when creating your PDF.

4.12.2 Distiller joboptions Profiles

Acrobat Distiller's joboptions files are easy to view and modify using the Distiller GUI, as shown in Figure 4-12. Launch the Distiller application, and set Default Settings (Acrobat 6) or Job Options (Acrobat 5) to the profile you want to view or edit. Then, select Settings Edit Adobe PDF Settings (Acrobat 6) or Settings Job Options (Acrobat 5).

As noted earlier, this graphical interface does not give you access to all the settings documented in Acrobat Distiller Parameters. Because joboptions files are plain text, you can also view or edit them using a text editor.

Figure 4-12. The Distiller GUI: a nice place to view and change joboptions files
figs/pdfh_0412.gif


4.12.3 Ghostscript joboptions Profiles

joboptions files are written in PostScript, so you can pass them to Ghostscript just before your input file using the -f option. Add a joboptions file to your GS Pdf Printer [Hack #39] by appending it to the end of the pdf_printer.cfg file you created, like so:

-dSAFER

-dBATCH

-dNOPAUSE

-Ic:\gs\gs8.14\Resource

-Ic:\gs\fonts

-Ic:\gs\gs8.14\lib

-sFONTPATH=c:\WINDOWS\FONTS

-sDEVICE=pdfwrite

-r1200

-c save pop

-f c:\gs\pdfhacks.gs.joboptions

The file pdfhacks.gs.joboptions comes with our Virtual Printer Kit [Hack #39] . It is organized and commented to make parameters easy to read and understand. Open it in your text editor and take a look. Edit it to suit your needs. Parameters not supported by Ghostscript are commented out.

If you need to manage a collection of these profiles, consider creating one GS Pdf Printer for each profile. Each printer would have its own Redirected Port, each port using its own cfg file, each cfg file referencing its own joboptions file.