This document describes how to use the command line Ghostscript client.Ghostscript is also used as a general engine inside other applications (for viewing files for example).Please refer to the documentation for those applications for using Ghostscript in other contexts.
DOWNLOAD https://tinourl.com/2yLyFm
The command line to invoke Ghostscript isessentially the same on all systems, although the name of the executableprogram itself may differ among systems. For instance, to invokeGhostscript on unix-like systems type:
Ghostscript is capable of interpreting PostScript, encapsulated PostScript(EPS), DOS EPS (EPSF), and Adobe Portable Document Format (PDF). The interpreter reads and executes the files in sequence, using the method described under "File searching" to find them.
The interpreter runs in interactive mode by default. After processing the files given on the command line (if any) it reads further lines of PostScript language commands from the primary input stream, normally the keyboard, interpreting each line separately. To quit the interpreter, type "quit". The -dBATCH -dNOPAUSE options in the examples above disable the interactive prompting. The interpreter also quits gracefully if it encounters end-of-file or control-C.
The interpreter recognizes many options. An option may appear anywhere in the command line, and applies to all files named after it on the line. Many of them include "="followed by a parameter. The most important are described in detail here. Please see the reference sections on options and devices for a more complete listing.
On Windows, the two digit number indicates the word length of the system for which the binary was built (sogswin32.exe is for x86 Windows systems, whilst gswin64.exe is for x86_64 Windowssystems). And the "c" suffix indicates a Windows console based binary (note that the"display device" window will still appear).Selecting an output deviceGhostscript has a notion of 'output devices' which handle saving or displaying the results in a particular format. Ghostscript comes with a diverse variety of such devices supporting vector and raster file output, screen display, driving various printers and communicating with other applications.
The command line option '-sDEVICE=device' selects which output device Ghostscript should use. If this option isn't given the default device (usually a display device) is used. Ghostscript's built-in help message (gs -h) lists the available output devices. For complete description of the devices distributed with Ghostscript and their options, please see the devices section of the documentation.
Note that this switch must precede the name of the first input file, andonly its first use has any effect. For example, for printer output in aconfiguration that includes an Epson printer driver, instead of just'gs myfile.ps' you might use
Once you invoke Ghostscript you can also find out what devices are available by typing'devicenames ==' at the interactive prompt.You can set the output device and process a file from the interactive prompt as well:
All output then goes to the Epson printer instead of the display until youdo something to change devices. You can switch devices at any time byusing the selectdevice procedure, forinstance like one of these:
Ghostscript also allows you to control where it sends its output. With a display device this isn't necessary as the device handles presenting the output on screen internally. Some specialized printer drivers operate this way as well, but most devices are general and need to be directed to a particular file or printer.
When printing on MS Windows systems, output normally goes directly to the printer, PRN. On Unix and VMS systems it normally goes to a temporary file which is sent to the printer in a separate step. When using Ghostscript as a file rasterizer (converting PostScript or PDF to a raster image format) you will of course want to specify an appropriately named file for the output.
Be aware that filenames beginning with the character % have a special meaning in PostScript. If you need to specify a file name that actuallybegins with %, you must prepend the %os% filedevice explicitly. For example to output to a file named %abc, you need to specify
Note, some devices (e.g. pdfwrite, ps2write, ...) only write the output fileupon exit, but changing the OutputFile device parameter will cause thesedevices to emit the pages received up to that point and then open the newfile name given by OutputFile.
Specifying a single output file works fine for printing and rasterizingfigures, but sometimes you want images of each page of a multi-pagedocument. You can tell Ghostscript to put each page of output in aseries of similarly named files. To do this place a template'%d' in the filename which Ghostscript will replace with thepage number.
Note: Since the % character is used to precede the page numberformat specification, in order to represent a file name that contains a %,double % characters must be used. For example for the file my%foothe OutputFile string needs to be my%%foo.
Note, however that the one page per file feature may not supported by all devices.Also, since some devices write output files when opened, there may be an extrablank page written (pdfwrite, ps2write, eps2write, pxlmono, pxlcolor, ...).
As a convenient shorthand you can use the -o option followed by the outputfile specification as discussed above. The -o option also sets the-dBATCH and -dNOPAUSE options.This is intended to be a quick way to invoke ghostscript to convert one or moreinput files.
Individual documents can (and often do) specify a paper size, which takesprecedence over the default size. To force a specific paper size andignore the paper size specified in the document, select a paper size asjust described, and also include the-dFIXEDMEDIA switch on thecommand line.
The default set of paper sizes will be included in the currentpagedevicein the InputAttributes dictionary with each paper size asone of the entries. The last entry in the dictionary (which has numeric keys)is a non-standard (Ghostscript extension) type of PageSize where the arrayhas four elements rather than the standard two elements. This four elementarray represents a page size range where the first two elements are the lowerbound of the range and the second two are the upper bound. By default theseare [0, 0] for the lower bound and [16#fffff, 16#fffff] for the upper bound.
For actual printers, either the entire InputAttributes dictionaryshould be replaced or the range type entry should not be included. To simplifyusing the default page sizes in the InputAttributes dictionary,the command line option -dNORANGEPAGESIZE can be used. Usingthis option will result in automatic rotation of the document page if the requestedpage size matches one of the default page sizes.
When the -dFIXEDMEDIA switch is given on thecommand line, the InputAttributes dictionary will only be populatedwith the single page size. This allows the -dPSFitPage option to fitthe page size requested in a PostScript file to be rotated, scaled and centeredfor the best fit on the specified page.
You can change the installed default paper size on an installed version of Ghostscript, by editing the initialization file gs_init.ps.This file is usually in the Resource/Init directory somewhere in the search path. See the section on finding files for details.
As noted above, input files are normally specified on the commandline. However, one can also "pipe" input into Ghostscript from anotherprogram by using the special file name '-' which is interpreted as standard input. Examples:
Ghostscript is normally built to interpret both PostScript and PDF files, examining each file to determine automatically whether its contents are PDF or PostScript. All the normal switches and procedures for interpreting PostScript files also apply to PDF files, with a few exceptions. In addition, thepdf2ps utility uses Ghostscript to convert PDF to (Level 2) PostScript.
The PDF interpreter and the other language interpreters handle these in slightly different ways. BecausePDF files enable random access to pages in the document the PDF inerpreter only interprets and rendersthe required pages. PCL and PostScript cannot be handled in ths way, and so all the pages must be interpreted.However only the requested pages are rendered, which can still lead to savings in time. Be aware thatusing the '%d' syntax for OutputFile does not reflect the page number in the original document. If youchose (for example) to process even pages by using -sPageList=even, then the output of-sOutputFile=out%d.png would still beout0.png, out1.png, out2.png etc......
Because the PostScript and PCL interpreters cannot determine when a document terminates, sending multplefiles as input on the command line does not reset the PageList between each document, each page in the second andsubsequent documents is treated as following on directly from the last page in the first document. The PDFinterpreter, however, does not work this way. Since it knows about individual PDF files the PageListis applied to each PDF file separately. So if you were to set -sPageList=1,2 and then send two PDF files, the result would be pages 1 and 2 from the first file, and then pages 1 and 2 from the second file. The PostScript interpreter, by contrast, would only render pages 1 and 2 from the first file. This means you must exercise caution when using this switch, and probably should not use it at all when processing a mixture of PostScript and PDF files on the same command line.
The XPS language like the PDF language allows random access to pages. The XPS interpreter handles all the PageList casesdiscussed above. It also handles cases such as:-sPageList=1,2,1,2 indicates repeated pages. Pages processed in order 1, 2, 1, 2.-sPageList=10-5 indicates pages will be processed in the order 10, 9, 8, 7, 6, 5.-sPageList=1-,-1 indicates first processing from page 1 to end and then from end to page 1.In addition, the XPS interpreter allows the use of a -dLastPage < -dFirstPage. In thiscase the pages will be processed backwards from LastPage to FirstPage.
7fc3f7cf58