-->
Previous Table of Contents Next


Chapter 24
Ghostscript and Ghostview

by Tim Parker

In This Chapter
•   Where to obtain Ghostscript

PostScript is a popular page descriptor language (PDL) used by many application packages. One of the strengths of PostScript is that a file in the PostScript format can be printed on any printer that understands the language, regardless of operating system or printer manufacturer. This lets you generate a file using an application that prints on every PostScript-compatible printer in the world instead of having to create one file for HP LaserJet IIs, another for Epson dot matrix printers, yet another for Canon Bubblejet printers, and so on.

As far as Linux is concerned, PostScript has one major problem: It’s a copyrighted name and imposes several restrictions on its use by the owner, Adobe Systems, Inc. Ghostscript was developed in an attempt to provide a utility that does the same task without those problems. As you can guess, Ghostscript is very similar to PostScript, but it has no copyright issues associated with it (and hence no licensing fees, legal worries, and so on). Actually, Ghostscript is a copyright utility, owned by the developers, but they allow it to be distributed under the GNU General Public License, making it readily available for use in Linux.


Tip:  
Ghostscript is copyrighted by Aladdin Enterprises, the utility’s developer. You can contact Aladdin if you want further information about Ghostscript or to license the utility, at Aladdin Enterprises, P.O. Box 60264, Palo Alto, CA 94306 or by email at ghost@aladdin.com.

The Ghostscript page description language can be generated by most applications. A utility called Ghostview lets you see Ghostscript-formatted files on your screen, a very handy feature. Ghostscript is not a single program but a set of them. The two programs we care most about here are the interpreter for the PostScript language and a set of C functions that can be linked into applications to provide PostScript-like functionality.

Where to Obtain Ghostscript

You most likely have Ghostscript provided with your Linux distribution set (such as a CD-ROM). Ghostscript is part of the AP Disk Set (applications) with most versions of Linux. If you decided to install the AP Disk Set when you installed Linux (which most people do), you will have the files for Ghostscript already installed on your system. If you did not install the AP Disk Set, you can do so at any time and specify just the Ghostscript utilities or the entire Disk Set, depending on your version of Linux and the installation utilities it includes.

To check whether you have Ghostscript installed on your system, you must usually search for the binaries and libraries as some versions of Linux install them in different locations. The easiest way to find out if Ghostscript is installed is to search for the binary called gs using the find command:


find / -name gs -print

If your system comes back with some matching entries (most likely in /usr/bin), then Ghostscript is probably installed. To verify the complete set of files is loaded you need to find out where your Linux version placed all the files. The number of files varies depending on the version of Ghostscript, but all versions include the following filenames:


bdftops.ps

decrypt.ps

font2c.ps

gs_dbt_e.ps

gs_dps1.ps

gs_fonts.ps

gs_init.ps

gs_lev2.ps

gs_statd.ps

gs_sym_e.ps

gs_type0.ps

gslp.ps

impath.ps

landscap.ps

level1.ps

prfont.ps

ps2ascii.ps

ps2epsi.ps

ps2image.ps

pstoppm.ps

quit.ps

showpage.ps

type1ops.ps

wrfont.ps

uglyr.gsf

Fontmap

Usually, the Ghostscript files are stored in either /usr/lib/ghostscript or /usr/share/ghostscript. Often there are version numbers attached to the installation directory, which complicates the issue. Again, use the find command to locate one of the Ghostscript utilities:


find / -name gs_statd.ps -print

In this case we’re searching for the file gs_statd.ps, which should be part of every Ghostscript installation. The file will be in /usr/lib/ghostscript on some Linux systems, while it may be placed under /usr/share on others. The output on a Caldera OpenLinux system looks like this:


[root@linux /root]# find / -name gs_statd.ps -print

/usr/share/ghostscript/3.33/gs_statd.ps

In this case, the Ghostscript files are in a directory called /usr/share/ghostscript/3.33. To check that all the files in the set are loaded, do a directory listing of the directory which contained the file you searched for. If Ghostscript is installed, you’ll see a set of files like the one shown in Figure 24.1.


Figure 24.1.  The contents of the Ghostscript directory.

All the fonts that are required by Ghostscript are stored in one of the directories under the primary Ghostscript directory, in this case /usr/local/ghostscript/3.33/fonts. A lot of fonts are included with most distributions.

If your version of Linux did not include a copy of the Ghostscript utilities, you can download the set from any of the standard distribution points for Linux. See Chapter 2, “Types of Linux,” to find out where to get a distribution. You can also get the Ghostscript set from Aladdin Enterprises.


Previous Table of Contents Next