pstopnm uses the value of the GHOSTSCRIPT environment variable as the file name for the Ghostscript program. If GHOSTSCRIPT is not set, pstopnm searches your PATH for a regular file named gs. If it doesn't find one, it assumes Ghostscript is in the file /usr/bin/gs.
pstopnm does not use the Netpbm libraries to generate the output files, so may not be entirely consistent with most Netpbm programs.
psfile[.ps] is the name of the input file. pstopnm will add the ps to the end of the name you specify if no file exists by the exact name you specify, but one with added does. Use - to indicate Standard Input.
If you use the -stdout option, pstopnm outputs images of all the pages as a multi-image file to Standard Output. Otherwise, pstopnm creates one file for each page in the Postscript document. The files are named as follows: If the input file is named psfile.ps, the name of the files will be psfile001.ppm, psfile002.ppm, etc. The filetype suffix is .ppm, .pgm, or .pbm, depending on which kind of output you choose with your invocation options. If the input file name does not end in .ps, the whole file name is used in the output file name. For example, if the input file is named psfile.old, the output file name is psfile.old001.ppm, etc.
Note that the output file selection is inconsistent with most Netpbm programs, because it does not default to Standard Output. This is for historical reasons, based on the fact that the Netpbm formats did not always provide for a sequence of images in a single file.
Each output file contains the image of a rectangular part of the page to which it pertains. The selected area will always be centered in the output file, and may have borders around it. The image area to be extracted from the PostScript file and rendered into a portable anymap is defined by four numbers, the lower left corner and the upper right corner x and y coordinates. These coordinates are usually specified by the BoundingBox DSC statement (a Postscript comment) in the PostScript file, but they can be overridden by the user by specifying one or more of the following options: -llx, -lly, -urx, and -ury. The presence and thickness of a border to be left around the image area is controlled by the use of the options -xborder and -yborder. If pstopnm does not find a BoundingBox statement in the input, and you don't specify image area coordinates on the command line, pstopnm uses default values. If your input is from Standard Input, pstopnm does not use the BoundingBox values (due to the technical difficulty of extracting that information and still feeding the file to Ghostscript), so you either have to specify the image area coordinates or take the default.
Unless you specify both output file width and height, via the -xsize and -ysize options, pstopnm maps the document into the output image by preserving its aspect ratio.
It has been reported that on some Postscript Version 1 input, Ghostscript, and therefore pstopnm, produces no output. To solve this problem, you can convert the file to Postscript Version 3 with the program ps2ps. It is reported that the program pstops does not work.
pstopnm -xborder 0 -yborder 0 -portrait -nocrop file.ps
Additional options may be needed if the document is supposed to be rendered on a medium different from letter-size paper.