Home
Ghostscript User Manual - Directory has no index file.
Contents
1. Ghostscript What is Ghostscript Installing Ghostscript Building Ghostscript from C Source Ghostscript Primer Ghostscript Reference More Ghostscript Applications Ghostscript User Manual Thomas Merz 1996 tm muc de This manual is adapted from appendix B of the following book PostScript and Acrobat PDF Applications Troubleshooting and Cross Platform Publishing by Thomas Merz Springer Verlag Berlin Heidelberg New York ISBN 3 540 60854 0 September 1996 420 pages plus CD ROM Book and manual are also available in German Thomas Merz Verlag Miinchen ISBN 3 9804943 0 6 The Ghostscript manual may be freely copied and redistributed in printed or digital form if no payment is involved Commercial reproduction is prohibited However the author agrees to any redistribution along with the Ghostscript software provided the distributor complies with the applicable Ghostscript license terms The Ghostscript manual is available from http www muc de tm Ghostscript User Manual Thomas Merz 1996 Notes on the page layout The design of the Ghostscript manual was chosen to meet several objectives gt It uses fonts from the PostScript core font set in order to reduce file size This also avoids font embedding issues since the original book layout uses fonts from the commercial Thesis family gt Pages can be printed on both letter and A4 format paper The double page design also makes it easy to read
2. Image Grayscale Color OBW Os 16 256 245 k 0 286 O Millions Ghostscript User Manual 2 Installing Ghostscript 6 2 3 gt Launch Ghostscript to test the font You can either use a suit able PostScript file or request the font manually in the con sole window TheSerifBold Italic findfont Alternatively you can install a fontmap file derived from anoth er platform For example you can create the fontmap automati cally on Windows see section 2 4 Font Configuration and install it in the Ghostscript folder together with the font files It s important not to change the font file names so make sure that they correspond to the fontmap entries Naturally you have to observe the font manufacturer s license conditions if the installed fonts originate from another system Installation on Unix Precompiled executables The complete C sources for Ghostscript are found on the CD ROM An individually config ured version of Ghostscript can be built with these source files This is described in section 3 Building Ghostscript from C Source To make your life easier the CD ROM contains pre compiled Ghostscript executables for some common Unix fla vors The table below indicates operating system version and CPU platform on which the executables have been built Check these to decide whether one of the precompiled binaries runs on your system If so the binary will save the hassle of building
3. 1 What is Ghostscript 2 Ghostscript can even help optimize the output of a PostScript capable printer if the computer s CPU is significantly faster than the printer s Ghostscript can in many cases speed up Post Script output PostScript printers with too little RAM some times cause trouble Ghostscript can remedy this by making use of your computer s main memory and a swap file or swap par tition Ghostscript has proven to be a robust and reliable Post Script RIP that is superior to many commercial PostScript clones PDF on every platform Beginning with version 3 33 Ghost script also contains an interpreter for the Portable Document For mat PDF the foundation of Adobe Acrobat Large parts of Ghostscript s PDF interpreter are written in PostScript It dis plays and prints PDF files and even converts them back to Post Script This makes Ghostscript the only program that displays Acrobat files on all Unix platforms although it only interprets layout related information and currently ignores hypertext links or annotations Starting with Ghostscript 4 0 the program is also capable of converting PostScript files to PDF i e it offers Distiller func tionality Though this feature called the pdfwrite device still has some shortcomings it is certainly an important milestone since Ghostscript is the first and still the only free program that converts PostScript to PDF Utilities and converters A complete Pos
4. f lt filename gt Execute the given file even if its name begins with a or f provides a way to terminate the token list for c g lt number1 gt x lt number2 gt Equivalent to dDEVICEWIDTH number1 and dDEVICE HEIGHT number2 see below r lt number gt r lt number1 gt x lt number2 gt Equivalent to dDEVICEXRESOLUTION number1 and dDE VICEYRESOLUTION number2 see below This is intended for devices that support different horizontal and vertical resolu tions especially dot matrix printers u lt name gt Undefines a name cancelling d or s I lt directories gt Add a list of directories to the search path for initalization and font files Multiple directories are separated with a semicolon MS DOS Windows OS 2 or colon Unix Pala Ghostscript first searches the current directory for library files This is the default Ghostscript User Manual P hee Ghostscript doesn t search the current directory for library files but uses the search path only Instructs Ghostscript to read standard input from file or pipe instead of from the keyboard Ghostscript reads and processes data from standard input and exits Note that it s not possible to read PDF files from standard input Special PostScript names used as switches The use doc file contains some more options for debugging Ghostscript A couple of names with special meanings is being interpreted by the Post
5. ll of the following commands may be cxcouted by ether diding the appropriate command button or Dring the keyboard equivalent where given into any open x window Section 3 1 Resizing Commands TEE Te mitong rans havea been mone e rhe ge Stoo ens Ne Fig 6 erat tana rea commas aot heip i orga Taly With Ghostview for Tee Eii ee X11 you can easily con ia fazanas fran the ota esl ie trol Chostscrint Vot lager sete Taekyon gtaes ren commen elise on te ige Se rol Ghostscript for lo smalar drtiemon Tieme conmands map te entered n they age vindar hase coals vidon oie en ed at ertt adie winton Tiny screen and printer out setsie S mayest ner vse wma uncover let vnc SE k i T ee put The page list allows 8 conois emi a quick access to random Taa saaana pages of DSC compliant documents PDF support They contain the most common device and file format drivers see the table in section 3 3 Configuration Op tions and Drivers To install one of the precompiled versions first decompress the Ghostscript package in a newly created directory copy the suitable program file e g for Linux and create a makefile the tar command creates the directory gs4 xx where 4 xx stands for the version number gunzip c cdrom software gs compress gs4xxsrc tgz tar xvf cd gs4 xx cp cdrom software gs linux gs gs in s unix gcc mak makefile Since you don t want to compile the C s
6. Trident SuperVGA 256 colors tvga D VGA 640x480 16 colors vga D X Window System X11 release 4 and higher welll u X Window System as alpha device xllalpha U X Window System as CMYK device 1 bit per color xllcmyk U X Window System as b w device xllmono U Printer drivers Apple Dot Matrix printer also for Imagewriter appledmp Apple Imagewriter high resolution iwhi Apple Imagewriter low resolution iwlo Apple Imagewriter LQ 320 x 216 dpi iwlq CalComp raster format ccr Canon BubbleJet BJ10e bj10e DWOU Canon BubbleJet BJ200 bj200 DWOU Canon Color BubbleJet BJC 600 and BJC 4000 bjc600 DWOU 3 Building Ghostscript from C Source 12 List of Ghostscript drivers available with version 4 01 Canon Color BubbleJet BJC 800 Canon LBP 8II laser printer Canon LIPS III laser printer with CaPSL Mitsubishi CP50 color printer DEC LA50 DEC LA70 DEC LA70 with low resolution extensions DEC LA75 DEC LA75plus DEC LJ250 Companion color printer DEC LJ250 alternate driver DEC LNO3 Epson AP3250 Epson compatible dot matrix printer 9 or 24 pin Epson compatible 9 pin intermediate resolution Epson compatible 9 pin triple resolution Epson LQ 2550 and Fujitsu 3400 2400 1200 color printers Epson Stylus Color Epson Stylus 800 HP DesignJet 650C HP DeskJet and DeskJet Plus HP DeskJet 500 HP DeskJet 500C 1 bit per pixel HP DeskJet 500C 24 bit per pixel also for DeskJet 540C HP DeskJet 500C same as cdjcolor HP De
7. an individual version Ghostview executables for these same systems are also found on the CD ROM Operating system CPU platform Linux x86 SunOS 4 1 1 Sparc Solaris 2 3 Sparc HP UX 9 01 HP PA Unixware System V Release 4 2 x86 DEC OSF 1 V3 2 DEC Alpha AIX 3 2 RS 6000 The installation of Ghostscript on Unix is controlled by the makefile Therefore you have to install the source package even if you can use one of the precompiled executables The precom piled executables are configured with PostScript Level 2 and Ghostscript User Manual Microsoft Word XV311 Fri Feb 1701 11 081995 Section 3 The Control Window 122 475 Section 3 The Control Window Ctagstep Y a wzontrols E Im WD Display ann Algorithms 2 colortes Jng e next Save Print Deete rostovjpg Lif 21 files 5884780 Color WEG 24 bit mode Using 46x4 Colorar Bly Bele e ole spat crab LBL AY cre orere autocrop anouta quit The xv controls window is the cera point of control for the L whid just goes to show how appropriately i ves named It contains corrals to resize the current Image flp end rotate Toa and aght up by clicking the Right monse butonin the image window or by pressing the key inside any open xv vindowz Doing either of these things shilethose controle windowis visible will Hdeit
8. gs dNODISPLAY sPSFile file ps file pdf A little shell script batch file contained in the Ghostscript dis tribution makes this even easier pdf2ps file pdf file ps The following additional options are available for PDF to Post Script conversion dPSBinaryOK Allows the generated PostScript files to contain binary data dPSLevell Generates PostScript Level 1 output dPSNoProcsSet Does not include the PostScript prolog procset in the output Note that the prolog is necessary when sending the generated file to a PostScript printer Converting PostScript to PDF distilling As of version 4 0 Ghostscript is also able to distill PostScript files to PDF Ghostscript must be compiled and linked with the pdfwrite de vice which is the case for Unix OS 2 and Windows by default The following command line can be used to distill PostScript files to PDF Ghostscript User Manual gs q dNOPAUSE sDEVICE pdfwrite sOutputFile file pdf file ps c quit Again a shell script batch file simplifies the process ps2pdf file ps file pdf There are no further options available for PS to PDF conversion Ghostscript recognizes the pdfmark and setdistillerparams opera tors However the distiller parameters are ignored with the ex ception of ASCII85 encoding Text in any other font than the 13 Acrobat base fonts is converted to bitmaps Also there are prob lems with fonts that use non standard encodings Both limita ti
9. p option creates a PostScript file instead of rendering the text on screen or printer gs q dNOPAUSE gslp ps p file ps file txt Extracting text from PostScript and PDF files The text extraction feature is a counterpart of the lineprinter emulation as it extracts the textual contents from a PostScript file There are at least two options for extracting text with Ghostscript the ps2ascii ps PostScript program and the more sophisticated psto text package ps2ascii ps is included in the Ghostscript distribution De pending on the dSIMPLE option the utility creates simple or complex output Simple output consists of text only whereas complex output additionally contains information about font type and string positions The positions are given in tenth of a point More details may be found at the beginning of ps2ascii ps some usage samples in the batch file ps2ascii bat A typical com mand line gs dNODISPLAY dNOBIND dWRITESYSTEMDICT dSIMPLE ps2ascii ps file ps c quit gt file txt Note that there is good reason to call the utility ps2ascii If the PostScript file contains any special characters German um lauts for example they don t make their way into the output file but get substituted with two character sequences of ASCII symbols The pstotext package is available as a Ghostscript add on from the following URL http www research digital com SRC virtualpaper pstotext html The pstotext code is also included i
10. run For printers with multiple resolutions you can also set the de sired print resolution using the r option gs sDEVICE epson r60x72 c quit Redirecting printer data On MS DOS Ghostscript sends printer data directly to the parallel port On Unix the printer data is sent to a temporary file You can also redirect it to your own print file gs sDEVICE laserjet sOutputFile laserjet prn file ps c quit If the output file name contains the variable d e g la ser od prn Ghostscript produces one output file per page and replaces the d with the page number On Unix you can also redirect the data to a pipe using the syntax Ghostscript User Manual 4 2 gs sDEVICE laserjet sOutputFile lp file ps c quit Finally Ghostscript sends the printer data to its standard out put with the following command line the q option suppresses messages gs q sOutputFile file ps c quit On Windows and OS 2 the easiest way to redirect printer data is to use GSview This frontend presents a menu for choosing the printer interface Page size Ghostscript uses U S letter size by default To change this use a text editor to locate the following line in the initialization file gs_init ps a4 PAPERSIZE where pop pop PAPERSIZE exch def ifelse In this line remove the comment sign at the beginning to use A4 format You can also replace the a4 in parentheses by any other known format
11. s much easier to use Mac style menu commands The sequence File Open lets you open EPSF or TEXT files e g the test file tiger ps in the Ghostscript folder Activate bal loon help to learn more about Ghostscript After one page has been rendered on screen the next page can be requested with Ghostscript Next Page The program can be closed with Quit The sequence Edit Settings changes such internal settings as page size or the scaling factor of the window Device drivers and file output By default Ghostscript ren ders into a Macintosh window It can also create instructions for other devices or graphics file formats You can copy the bit mapped contents of a window to the clipboard or save it as a PICT file with File Save As In the Devices menu you can choose the output file Although the Ghostscript source dis tribution contains many dozens of drivers the Macintosh ver sion only contains the screen driver a few printer drivers and drivers for the file formats PCX PBM and TIFF This decision has been made in order to reduce storage requirements Since it is not possible to dynamically load drivers you have to recom pile and link Ghostscript if you want to use additional drivers Font configuration Ghostscript uses PostScript fonts in ASCII format Since PostScript fonts on the Mac are usually stored in a compact resource format Ghostscript cannot use them d
12. 2 many additional EPS functions are possible with GSview in cluding determining a correct bounding box and creating or de leting preview bitmaps More details can be found in section 3 5 2 Adding a Preview Image Converting to the Adobe Illustrator format As of ver sion 4 01 a special Ghostscript driver for creating Adobe Illus trator format is not yet available Instead Ghostscript uses the sophisticated PostScript program ps2ai ps Although this con version is bound to some restrictions in many cases it yields graphics files which may be opened and edited with any Ilus trator compatible program On Unix redirect Ghostscript s out put to a file On Windows OS 2 and the Macintosh it s easier to have Ghostscript create the file directly To achieve this change the variable jout at the beginning of ps2ai ps to a value of true Assign the name of the AI file you want to create to the joutput variable Now launch Ghostscript with the converter and the PostScript file to be converted to AI format gs dNODISPLAY ps2ai ps file ps For EPS files that are missing the showpage operator at the end you have to type this operator at the Ghostscript prompt before quitting in order to completely render the page For the conver sion to be successful it is necessary for Ghostscript to have ac cess to all fonts used in the PostScript file Note that the conver sion isn t perfect there may be problems concerning color ramps and g
13. 4 01 Each line lists the name of the device or format and the short name of the driver The last col umn in the table tells you on which of the following platforms the particular driver is part of the standard configuration MS DOS 386 D Windows 32 bit W OS 2 O Unix U and Ghostscript User Manual Mac M The driver name is used in the makefile as well as for selecting a driver within Ghostscript The makefile variables DEVICE_DEVS1 to DEVICE_DEVS15 contain the names of the drivers to be included in the program If you don t supply a driver name at startup Ghostscript uses the first driver in its list which is a display driver on all platforms List of Ghostscript drivers available with version 4 01 Display drivers ATI Wonder SuperVGA 256 colors atiw D AT amp T 3b1 Unixpe monochrome display att3b1 Borland Graphics Interface bgi CRT sixels e g VT240 compatible terminals sxlcrt EGA 640x350 16 colors ega D Hercules Graphics Display herc Linux PC with VGALIB vgalib Linux PC with VGALIB 256 colors lvga256 Macintosh window QuickDraw mac M Microsoft Windows 3 1 DLL mswindll W OS 2 DLL bitmap os2dll O OS 2 Presentation Manager os2pm Private Eye display pe Sony Microsystems monochrome display sonyfb SunView window system sunview SuperVGA with S3 Chip 86C911 s3uga SuperVGA 800x600 16 colors svgal6 D SuperVGA with Tseng Labs ET3000 4000 Chip 256 colors tseng D SuperVGA with VESA driver vesa
14. Options Save Options Unix systems generally use the mailcap file for configuring MIME types Use the following entry for Ghostview see below for the safer option application postscript ghostview safer s The relation between MIME types and file extensions is con trolled by the mime types file If the following line doesn t al ready exist add it to the mime types file application postscript ai ps eps Like PostScript you can also configure Ghostscript and GSview as helper application for PDF files Proceed as above using the pdf suffix and a MIME type of application pdf Note that Ghostview doesn t yet directly support PDF PostScript files and security PostScript being a full blown programming language contains operators for modify ing and deleting files This opens a security gap when down loading unknown files In the worst case a file pretending to be Ghostscript User Manual a harmless PostScript image may delete files from your local hard disk possibly even with root permission Although there are no known cases of such trojan horses you should protect yourself against this kind of attack Ghostscript s dSAFER op tion disables critical file operators the interpreter refuses to open files other than read only GSview launches Ghostscript with this option by default Ghostview for Unix uses the option if launched with the safer option itself 5 Ghostscript Reference S
15. TrueType data which a PostScript inter preter cannot directly process Ghostscript contains some addi tional code for interpreting raw TrueType files This code is acti vated by the ttfont makefile option Since TrueType plays an important role for Windows users the Windows Ghostscript versions are configured with the ttfont feature by default Ghostscript User Manual This means that the Windows TrueType font directory can be configured for use with Ghostscript just as any PostScript font directory However Ghostscript only recognizes TTF font files when searching font files via the GS_FONTPATH variable it s not possible to process TrueType files via the run operator You can work around this with the following instruction file ttf r file loadttfont Platform fonts on Windows and X11 Ghostscript always needs access to all PostScript fonts used in a document It ras terizes all the characters itself instead of delegating this task to the operating system ATM or the X server like other programs do However to speed up processing Ghostscript sometimes uses system fonts This feature is called platform fonts and is used only for certain font sizes and horizontal or vertical text Even so the PostScript font name must exactly match the sys tem font name For small font sizes platform fonts generally improve screen font representation In some situations however they make it worse e g if PostScript
16. and system font metrics don t match which results in ugly formatting Another problem affects fonts with unusual character sets encodings In both cases you can turn off platform fonts by launching Ghostscript with the dNOPLATFONTS option There is also a special X Window re source to achieve this Ghostscript useExternalFonts false 3 Building Ghostscript from C Source Since the C source code of Ghostscript is readily available you can build an executable version of the interpreter if you have a C compiler for your system and some experience compiling C programs This way you can link in additional drivers that are contained in the Ghostscript distribution but that due to mem ory restrictions are not compiled into the standard versions More adventurous programmers also have the chance to imple ment their own extensions to Ghostscript The following sec tions will give an overview of the compilation process and the configuration options 3 Building Ghostscript from C Source 9 3 1 3 2 A Small Tour of Ghostscript Files The Ghostscript source directory contains several hundred files The compilation may even double this number so you may well get lost in this multitude of files The following table lists the most important file types contained in the Ghostscript distribution Files Contents readme news notes on the current version new user txt overview of Ghostscript use txt information on using Ghos
17. for the name of the directory to which the software is to be in stalled and decompresses the ZIP archives Then it creates a program group Windows 3 x or a start menu entry Windows 95 When GSview is first run it asks whether you want to create a file association between GSview and files with the extension ps eps and pdf This means that double clicking a file of the respective type launches GSview automatically You may al ways want to have the ps and eps associations created howev er create the pdf association only if you don t want to use Ac robat Reader If you didn t install Ghostscript into the default directory you have to choose Options Configure Ghostscript after launching GSview for the first time to the enter the path name of the Ghostscript DLL the include path and possibly some Ghostscript options see figure 2 Ghostscript User Manual Configure Ghostscript x Ghostscript DLL GS Cancel Ghostscript Include Path CAGSTOOLS gs4 01 C GSTOOLS gs4 01 fonts c pstonts Defaults Ghostscript Options Hd NOPLATFONTS Help FEL Fig 2 Note that GSview requires the 32 bit version of Ghostscript With File Open you can open PostScript files GSview then passes these files on to Ghostscript for rendering Using the menu sequence Media Display Settings you can adjust the screen size larger resolution values yield a larger screen repre se
18. the manual on screen gt A two page spread was slightly reduced and printed on one sheet of paper in order to economically make use of paper and screen estate Production notes I created a PostScript file from the marginally adapted FrameMaker book file via the PSPrinter PostScript driver The re sulting PostScript file was distilled to PDF Bookmarks article threads and general document information were automatically generated by FrameMaker with a little manual help Translation If you are interested in translating the Ghostscript manual to other languages please contact the author tm muc de The manual is currently available in English and German This is version 1 1 of the manual It covers Ghostscript 4 01 and GSview 2 0 Ghostscript User Manual 1 What is Ghostscript L Peter Deutsch founder of Aladdin Enterprises Menlo Park California wrote the PostScript Level 2 and PDF interpreter Ghostscript in the C programming language The program runs on most operating systems including MS DOS Windows 3 x Windows 95 Windows NT OS 2 Macintosh Unix and VAX VMS and has been available free of charge ever since its intro duction 1988 With the help of many users and programmers on the Internet Ghostscript has become a high quality and versa tile PostScript interpreter Peter Deutsch also distributes a com mercial version with customer specific enhancements and sup port Ghostscript s capabilities include Scree
19. A list of all formats known to Ghost script and their dimensions can be found in the gs_statd ps file Alternatively you can change the page size on the Ghostscript command line gs SPAPERSIZE legal file ps Printing with Ghostscript Printing on MS DOS To reduce memory problems you should use gs386 exe if possible The following longish call pro cesses a PostScript file for output on a Laserjet 4 printer con nected to the parallel interface gs386 q dNOPAUSE sDEVICE ljet4 file ps c quit The c quit option is used to quit Ghostscript after the PostScript file is completely rendered Due to the q option Ghostscript it self works quietly However the 386 MS DOS extender still pre sents its copyright banner You can suppress it with an environ ment variable set DOS4G quiet If your printer is not connected to the parallel interface or you want to bring the printer data to another machine you can redi rect it to a file 4 Ghostscript Primer 15 gs386 q dNOPAUSE sDEVICE ljet4 sOutputFile ljet prn file ps c quit To print this file send it to the printer interface with the copy command copy b ljet prn lpt1 The b binary option is important because otherwise the copy command may not completely transfer the printer data Printing on Windows 3 x In Windows it is easiest to use GSview for printing with Ghostscript After installing this Ghostscript frontend correctly you can select a PostScri
20. R titf6 ps GSview olx File Edit Options View Orientation Media Help File tif6 ps Page 96 96 of 21 B D Input Picture Owput Picture Forna nadam EE Figure 1 Baseline Process Encoder and Decoder A functional block diagram of the Baseline encoding and decoding processes is containedin Figure 1 Encoder operation consists of dividing each component of the input image into 8x8 blocks performing the two dimensional DCT on each block quantizing each DCT coeficient uniformly subtracting the quantized DC coefficient from the corresponding term inthe previous block and then entropy coding the quantized coefficients using variable length codes VLCs Decoding is performed by inverting each of the encoder overationsin the reverse order The DCT Before performing the foward DCT input pixels are level shifted so that they range from 128 to 127 Blocks of 8x8 pixels are transformed with the two cimensional 8x8 DCT Fig 1 GSview simplifies Ghost script usage under Windows and OS 2 It also offers additional fly F Chet Flux cos PM cog PUI possibilities e g dealing D with EPS files 4 E 1 2x 1 2y 1 Flav F Cctv fixy cos Piu co LY and blocks are inverse transformed bythe decoder with the Inverse DCT Ghostscript and GSview are already contained in that directory After displaying some information the setup programs asks
21. Script code in Ghostscript s initialization files They work in a similar way to command line options dDEVICEWIDTH lt number gt dDEVICEHEIGHT lt number gt Sets width and height of the device respectively in pixels dDEVICEXRESOLUTION lt number gt dDEVICEYRESOLUTION lt number gt Sets the device horizontal resp vertical device resolution in dpi dCOLORSCREEN On devices with at least 150 dpi resolution forces the use of sep arate halftone screens with different angles for the process col ors this produces the best quality output dCOLORSCREEN 0 Uses separate screens with the same frequency and angle for the process colors dCOLORSCREEN false Forces the use of a single binary screen If COLORSCREEN is not specified the default is to use separate screens with differ ent angles if the device has fewer than 5 bits per color dDISKFONTS Causes character outlines in fonts to be loaded from disk on de mand only This slows down text rendering but increases the number of fonts which may be loaded into RAM This tech nique is mainly intended for low memory systems such as MS DOS 5 Ghostscript Reference Section 18 dDITHERPPI lt lpi gt forces all devices to be considered high resolution and forces use of a halftone screen or screens with lpi lines per inch disre garding the actual device resolution Reasonable values for lpi are N 5 to N 20 where N is the resolution in dots per in
22. ame at the Ghostscript prompt gs fontfile prfont ps GS gt FontName DoFont 6 More Ghostscript Applications 24
23. and directory paths appropriately For many years the Ghostscript distribution contained only low quality public domain fonts In 1996 the German company URW contributed commercial quality PostScript Type 1 fonts for use with the Ghostscript package These include look alikes for the 35 PostScript core fonts found in most laser print ers The URW fonts are distributed under the Aladdin and the GNU license You can find the URW fonts in the urw directory on the CD ROM You can significantly enhance text representation on screen and paper by integrating high quality fonts Ghostscript uses all flavors of PostScript fonts and formats i e Type 1 Type 3 ASCII and binary Ghostscript also is capa ble of processing TrueType fonts see below It is necessary for Ghostscript User Manual Ghostscript to have access to the font file installing the font in the operating system ATM or Display PostScript is not enough Static font configuration There are two choices for the font configuration If the installed font base rarely changes put one or more font directories in the environment variable GS_LIB For example if you want to launch Ghostscript directly from CD ROM on MS DOS or Windows use the following set GS_LIB g fonts urw On Unix you have to export the variable using the command GS_LIB usr local share ghostscript fonts export GS_LIB a Another difference for Unix systems is the colon used as path se
24. cesses the files one after the other Then Ghostscript prompts for PostScript commands GS gt At this prompt you can issue PostScript commands If it is clumsy or uncommon to pass file names on the command line e g on Windows you can open files with the run command at the prompt Try the tiger ps sample file included in the Ghost script distribution 4 Ghostscript Primer 14 GS gt file ps run On the Mac it s even easier to use the File Open menu command Note concerning MS DOS path names Since the backslash escapes the next character in PostScript strings you have to use double backslashes in path names However a single Unix style slash also works as a separator in path names for ex ample GS gt c gs tiger ps run The following command exits the interpreters Gs gt quit Alternatively you can append c quit to the command line Selecting a driver Usually Ghostscript uses the first driver in its internal list configured at build time This driver outputs to the screen in the standard configurations on all operating systems You can select another driver on the command line gs sDEVICE laserjet file ps c quit This instructs Ghostscript to produces output for the particular device or file format laserjet in the example above Using the following commands at the Ghostscript prompt you can change the driver at any time GS gt epson selectdevice GS gt file ps
25. ch dFirstPage lt n gt Starts interpreting on the given page of a PDF document dFIXEDMEDIA Causes the media size to be fixed after initialization Pages are scaled or rotated if necessary dF IXEDRESOLUTION Causes the output resolution to be fixed dLastPage lt n gt Stops interpreting after the given page of a PDF document dLOCALFONTS This is a compatibility option for certain obsolete fonts This op tion makes Ghostscript load type 1 fonts always to local VM dNOBIND Disables the bind operator useful for debugging dNOCACHE Disables the font cache useful for debugging dNOCIE substitutes DeviceGray and DeviceRGB for CIEBasedA and CIEBasedABC color spaces respectively useful on very slow systems where color accuracy is less important dNODISPLAY Suppresses normal initialization of the output device This is useful for debugging and also for PostScript converters that don t produce any screen or printer output e g ps2ai dNOFONTMAP Suppresses loading of the Fontmap file dNOGC Disables the level 2 garbage collector useful for debugging Ghostscript User Manual dNOPAUSE Disables the prompt and pause at the end of each page This is useful for driving Ghostscript from another program dNOPLATFONTS Disables platform fonts for X Windows or Microsoft Windows see section 2 4 Font Configuration dNOPROMPT Disables the prompt but not the pause at the e
26. e 182 OS 2 system printer driver only for OS 2 DLL Ricoh 4081 laser printer Sony Microsystems NWP533 laser printer StarJet 48 inkjet printer SPARCprinter Tektronix 4693d color printer 2 bits per RGB component Tektronix 4693d color printer 4 bits per RGB component Tektronix 4693d color printer 8 bits per RGB component Tektronix 4695 4696 inkjet plotter Xerox XES 2700 3700 4045 and others Fax and file format drivers BMP monochrome BMP 4 bits EGA VGA BMP 8 bits BMP 24 bits CGM b w low level output only CGM 8 bits low level output only CGM 24 bits low level output only CIF file format for VLSI DigiBoard DigiFAX high resolution DigiBoard DigiFAX low resolution Fax group 3 with EOLs no header or EOD Fax group 3 2 D with EOLs no header or EOD Fax group 4 with EOLs no header or EOD ImageMagick MIFF format 24 bit color RLE compressed MGR devices 1 bit monochrome MGR devices 2 bits gray scale MGR devices 4 bits gray scale MGR devices 8 bits gray scale MGR devices 4 bits color MGR devices 8 bits color PCX monochrome PCX 8 bits gray scale imagen m8510 mswinprn mswinpr2 cp50 necp6 oce9050 okiibm oki182 os2prn r4081 nwp533 sj48 sparc t4693d2 t4693d4 t4693d8 tek4696 xes bmpmono bmp16 bmp256 bmp16m cgmmono cgm8 cgm24 cif dfaxhigh dfaxlow faxg3 faxg32d faxg4 miff24 mgrmono mgrgray2 mgrgray4 mgrgray8 mgr4 mgr8 pexmono pexgray WO WO WO WO 3 Building Gh
27. ection 5 1 Command Line Options On all platforms Ghostscript evaluates several command line options used to control the interpreter h help These options cause Ghostscript to print a brief help message and a list of available i e built in device drivers on screen lt filename gt Ghostscript reads the specified file and treats its contents the same as the command line This makes it easier to use com mand line options on Windows or to use command lines longer than 128 characters on MS DOS lt file ps gt argl lt file ps gt argl Ghostscript treats the file name as usual but stores the remain ing arguments in an array named ARGUMENTS in userdict This way PostScript programs can access options and command line arguments lt filename gt argl Same as and but expands arguments from argfile c tokens Interprets arguments up to the next as PostScript code and executes them Each argument must be exactly one token un 5 Ghostscript Reference Section 17 Dname token dname token Defines a name in systemdict with the given definition equiva lent to name token def This option is mainly used for special names see below Dname dname Defines name in systemdict with a value of true Sname string sname string Defines a name in systemdict with the given string definition equivalent to name string def mc quiet Suppress normal startup messages
28. ed by make files which you can adapt as necessary To improve legibility the makefiles are split in parts gs mak Ghostscript core source lib mak graphics library int mak interpreter devs mak device drivers jpeg mak JPEG library libpng mak PNG graphics file format library zlib mak compression routines used for the PNG format All other mak files are platform specific makefiles used to con figure the development system The compilation process for different platforms and the supported development systems are described in full detail in the file make doc The following de scription is not intended to replace this file but to give you a jump start Compiling on MS DOS Windows OS 2 First decompress the C source from the compressed archives gs4xxsr1 zip and gs4xxsr2 zip The files in the other archive files jpeg_6a zip Ipng089c zip and zlib102 zip contain additional libraries used by Ghostscript They are stored in three subdirectories of the Ghostscript directory The d option of pkunzip creates the directory gs4 xx x represents the CD ROM drive letter pkunzip d x software gs compress gs4xxsrl zip pkunzip d x software gs compress gs4xxsr2 zip cd gs4 xx mkdir jpeg 6a cd jpeg 6a pkunzip x software gs compress jpeg_6a zip oro here mkdir libpng cd libpng pkunzip x software gs compress lpng089c zip coro ers mkdir zlib cd zlib pkunzip x software gs compress zlib102 zip The Ghostscri
29. ensing Ghostscript should contact Al addin Enterprises or one of its distribution partners The com plete text of the AGFPL is found in the file named public which is part of the Ghostscript distribution fileset 2 Installing Ghostscript 2 1 Installation on MS DOS Windows and OS 2 Requirements and versions The Ghostscript installation not including fonts uses 3 MB hard disk space There are sev eral flavors of Ghostscript for PC systems System File name Notes MS DOS gs exe Limited to 640 KB little support MS DOS 80386 and gs386 exe plus Version with DOS extender very fast higher dos4gw exe Windows 3 x gswinl6 exe plus 16 bit version it consists of a DLL and a gsdll16 dll small EXE program Windows 3 x with gswin32 exe plus 32 bit version with enhancements for Win32s gsdll32 dll Windows 95 and NT it consists of a DLL Windows 95 and NT _ gs16spl exe and a small EXE program OS 2 gsos2 exe plus Uses gspmdrv exe as display driver for the gsdll2 dll presentation manager Setup program for Ghostscript and GSview Under Win dows and OS 2 the user frontend GSview facilitates using Ghostscript by supplying a handy interface to the interpreter With the GSview setup program you can install both Ghost script and GSview comfortably In the software gsview windows directory on the CD ROM launch the program setup exe for Windows or os2setup exe for OS 2 The required ZIP files for 2 Installing Ghostscript 3
30. er unmodified you can manually use Ghostscript for printing Ghostscript User Manual gs q dNOPAUSE sDEVICE ljet4 sOutputFile 1p file ps c quit You can find hints on integrating Ghostscript in systems with a printcap database in the file unix lpr doc The accompanying shell script Iprsetup sh automatically creates some necessary di rectories and links as well as printcap entries Use a text editor to adapt the list of device drivers in this script that Ghostscript is supposed to use Obviously these drivers must be compiled into the Ghostscript executable You can also set up additional printcap filters with Iprsetup sh By default it creates an input filter consisting of a shell script with the actual Ghostscript call After executing lprsetup sh follow the instructions in unix Ipr doc i e create some links as indicated in the file integrate the generated printcap insert file into the system printcap and adjust the new entries to your local setup serial interface pa rameters etc The usr local lib ghostscript filt directory con tains several links to the unix Ipr sh file In this file you have to add the I option if you didn t install Ghostscript in the stan dard directories On System V Release 4 and related systems you can define print filters for specific file types The spooler launches these fil ters for printing on devices which are not supported directly To define Ghostscript as a filter change to the di
31. figuring Ghostscript path names in GSview 4 set GS_LIB d progs gs set PATH other path entries d progs gs Alternatively the command line option I can be used to tell Ghostscript where to find its files gs ID progs gs Launching and testing Ghostscript On MS DOS you start Ghostscript by typing the program name as usual With Windows it s easier to double click on Ghostscript s icon in the file manager or to create an icon in the program manager The file tiger ps part of the Ghostscript distribution is perfectly suit ed to test your installation Start Ghostscript and type in the fol lowing command at Ghostscript s prompt GS gt tiger ps run Ghostscript should now display the test file on screen Having finished the page Ghostscript asks you to gt gt showpage press lt return gt to continue lt lt If the file contains more than one page Ghostscript renders the next page after the return key is pressed Caution The installation is not yet complete To complete the installation font access for Ghostscript needs to be config ured This is covered in section 2 4 Font Configuration If you want Ghostscript to use the same command line options every time you can use the environment variable GS_OPTIONS Ghostscript evaluates this variable before checking the real command line options Especially with Windows 3 x this is much more convenient than the rather clumsy call by way of the prog
32. g32d tiffg4 tifflzw tiffpack tiffl2nc tiff24nc DWOUM DWOUM DWOUM wu DWOU DWOU DWOU UM uM uM uM wou wou wou wou wou uM UM DWOU DWOU DWOU DWOU DWOU DWOUM DWOUM DWOU DWOU 4 Ghostscript Primer 4 1 This section is meant to give you a jump start into directly using Ghostscript If you use GSview or Ghostview to drive Ghost script you only have to configure the appropriate Ghostscript call the rest is handled by the frontend Launching Ghostscript In the following examples gs always represents the name of the Ghostscript executable file Depending on your platform the actual name may vary File search path First you have to make sure that Ghost script finds its initialization and font files When searching for files without an absolute file name Ghostscript uses the follow ing search order gt The current directory gt The directories listed at the I command line option e g on MS DOS Windows or OS 2 gs Id gstools gs4 xx d gstools gs4 xx fonts or on Unix gs I usr local lib gs usr local psfonts gt The directories listed in the GS_LIB environment variable gt Predefined directories selected at build time using the GS_LIB_DEFAULT makefile variable C gs on MS DOS Windows or OS 2 usr local share ghostscript 4 xx on Unix Watch the tiger Ghostscript accepts the names of the Post Script files to display or print gs filel ps file2 ps The interpreter pro
33. hoose the appropriate makefile from mak and create a symbolic link with the following command assuming you use the GNU compiler ln s unix gcc mak makefile Use unixansi mak or unix cc mak respectively for an ANSI or K amp R compiler On some systems you have to adapt the search path for X11 specific include files and additional libraries These are controlled by the XINCLUDE und LDFLAGS variables in the makefile which you can change before launching make By changing the prefix variable in the makefile you can adapt the install directory Now compile and install Ghostscript with the command Ghostscript User Manual make install Consult the make txt file if you have trouble with the build pro cess or experience compilation errors The install process needs root permission on most systems After compiling Ghostscript the install command copies the executable program to usr local bin and the auxiliary files to usr local share ghostscript 4 xx To complete the installation you have to install fonts for Ghost script as described in the next section Now you should install and compile the Ghostview source This is accomplished with the commands gunzip c gsviewl5 tgz tar xvf cd ghostview 1 5 xmkmf make make install If your system doesn t have the xmkmf program you have to adapt the Ghostview makefile manually this shouldn t be too hard if you have ever worked with makefiles Compiling on the Macintosh I
34. in section 7 2 3 Installing Additional Fonts Dynamic font configuration For large or frequently chang ing font installations the second method is preferable Ghost script checks the GS_FONTPATH environment variable to de termine the available font files and scans these files to find out the names of the fonts they contain Similar to GS_LIB above this variable contains one or more directory names Since Ghostscript automatically recognizes fonts this method is much more flexible However since Ghostscript checks all font directories every time a new font is requested this method in creases startup time To avoid inconsistencies make sure there is no Fontmap file in one of the GS_LIB directories if you use GS_FONTPATH or launch Ghostscript with the dNOFONT MAP option TrueType fonts Starting with Version 4 0 Ghostscript con tains a rasterizer for TrueType fonts Note that Ghostscript sup ports two flavors of TrueType fonts Type 42 fonts These contain TrueType data wrapped in Post Script instructions and can be directly processed by the inter preter Type 42 capability is integrated in all Ghostscript config urations which include Level 2 support which is the case for all default makefiles Level 2 capable Ghostscript versions accept PostScript files with embedded Type 42 fonts created for ex ample by the Windows PostScript driver Native TrueType files Files in TTF format as installed under Windows contain raw
35. ing A technique cal led anti aliasing tries to improve text or graphics rendering by making use of gray levels for smoothing Anti aliasing is imple mented in a couple of Ghostscript drivers Windows and OS 2 display drivers and the Portable Graymap Format PGM und Portable Pixmap Format PPM file format driver To make use of anti aliasing the bit depth must be at least 8 bits The follo wing command line can be used to convert a PostScript file to PGM with anti aliasing gs sDEVICE pgm dTextAlphaBits 4 sOutputFile file ppm file ps c quit Possible alpha values are 1 no anti aliasing 2 and 4 Anti aliasing for graphics can independent of text anti aliasing sim ilarly be achieved using the dGraphicsAlphaBits 4 option Converting PostScript to PostScript raster graphics This conversion makes it possible to print PostScript Level 2 files on devices with PostScript Level 1 interpreters Ghost script s psmono driver produces not DSC compliant PostScript files containing a raster version of the file as a PostScript Level 1 bitmap Similar to the TIFF conversion you can select the reso lution gs sDEVICE psmono r600 sOutputFile filel ps file2 ps By default the psmono driver uses a resolution of 300 dpi Ghostscript User Manual Additional features for EPS files The shell script batch file ps2epsi or ps2epsi bat creates ASCII previews for EPSI files Usage notes can be found in ps2epsi doc On Windows and OS
36. irectly this is planned for a future version However you can convert standard Mac PostScript fonts for use with Ghostscript with the unadobe utility on the CD ROM Execute the following steps for each font you want to use gt Start unadobe and open the font file unadobe doesn t change the font data but instead converts the resource representa tion to a textual representation suitable for Ghostscript Save the generated font file in the Ghostscript folder using the old file name or a new one gt Edit the file Fontmap in the Ghostscript folder with a text edi tor e g SimpleText or TeachText Append a line similar to the following at the end of the file TheSerifBold Italic TheSerBol This line contains the PostScript name of the font and the name of the font file that you used in the first step The line must be terminated with a semicolon If you re unsure about the exact PostScript name of the font you can open the font file created by unadobe with a text editor and look for the en try FontName File Edit Ghostscript Bitte Fig 5 ymac In the Devices menu cdj550 you can choose a driver Fig 4 7 Rendering Window Settings The Settings panel stcolor 3 changes page size Page Size J210 Jey Oin Penman for Mac GS Viewer o scaling factor and aT l cm pexgray color parameters pcx16 pcx256 pcx24b pbm pbmraw pgm pgmraw ppm ppmraw tifflzw tiffpack Scaling 100
37. n addition to the source code in MS DOS or Unix format you need the archive gsmacs rc hqx to compile Ghostscript for the Mac This archive contains some additional Macintosh specific files The source files end up in several folders You ll find an overview of the build pro cess in the Mac GS Viewer Manual part of the Ghostscript files and some hints for compiling with the MPW or CodeWarrior compilers in the file worksheet Compiling on other systems The file readme contains some remarks on Ghostscript ports to other systems including VMS Amiga Atari ST Acorn Archimedes and NEXTSTEP 3 3 Configuration Options and Drivers You can adjust the Ghostscript makefile to build a version that suits your needs with several extensions and an individual as sortment of drivers The most important options are PostScript Level 1 PostScript Level 2 and PDF Standard configurations for most systems include PostScript Level 2 and on 32 bit sys tems additionally PDF You can use the FEATURE_DEVS vari able in the makefile to control the interpreter s configuration 3 Building Ghostscript from C Source 11 The second configuration option relates to the set of included drivers Since it is not possible to load Ghostscript drivers dy namically at runtime you have to choose the driver set when building the program In doing so you trade functionality for memory efficiency If all available drivers were included in Ghostscript the prog
38. n output Ghostscript displays PostScript data on the screen This is useful to examine PostScript graphics or for sav ing a few trees if you want to browse some product documenta tion which is available in PostScript format only Ghostscript checks PostScript files before you transfer them e g to a ser vice bureau Are all the necessary fonts there Are the graphics okay Do the files contain all pages Ghostscript also helps with PostScript trouble shooting A faulty page can be rendered on screen revealing which graphics element yields an error message Ghostscript provides the usual PostScript error messages A separate frontend to the interpret er called GSview for Windows and OS 2 or Ghostview for the X Window System simplifies the handling of PostScript files with a user friendly GUI interface with these frontends the user can access random pages in the document Without them Ghostscript displays the pages one after another from the be ginning to the end of the file Printer output Another important task of a PostScript RIP is to render PostScript data for output on a graphics capable printer The Ghostscript distribution contains a wealth of driv ers for a wide range of printer models from the more popular to the more esoteric A list of all drivers is found in section 3 3 Configuration Options and Drivers These drivers are an inte gral part of Ghostscript and are not related to Macintosh or Windows system drivers
39. n the GSview distribution as a separate DLL Simply use GSview s Edit Text Extract feature to make use of it If you check Options Quick Text a different method will be used for text extraction which is less accurate but faster Note that unlike ps2ascii ps pstotext pre serves umlauts and other special characters 6 4 Font Tools Creating AFM files The printafm ps utility creates an AFM file for any given PostScript font The metrics files created only Ghostscript User Manual contain character width information kerning data are missing because they cannot be reconstructed from the font To use the utility enter the PostScript font name at the end of printafm ps The program print the AFM file to its standard output which you have to redirect to a file If the font isn t configured for Ghostscript via the Fontmap file or the GS_FONTPATH envi ronment variable enter the font file name on the Ghostscript command line unfortunately the redirection doesn t work on Windows or on the Mac gs dNODISPLAY q fontfile printafm ps fontname gt fontname afm Printing font tables The prfont ps utility prints character ta bles for any given PostScript font It first prints all characters contained in the encoding vector of the font then uncoded characters If the font isn t configured in Ghostscript enter the font file name on the Ghostscript command line Then type the font name and the procedure n
40. nd of each page This prevents text and graphics output from being mixed on PC displays dORIENT1 Exchanges the meaning of the values 0 and 1 for indicating page orientation with setpageparams This is needed for the Post Script code of certain applications dSAFER Disables the PostScript operators for writing or deleting disk files This is intended for using Ghostscript as viewer for a Web browser in a secure mode dSHORTERRORS Brackets several error messages with and as Adobe Interpreters do dWRITESYSTEMDICT Systemdict remains writable This is necessary for some utility programs that must bypass normal PostScript access protection such as font2c and pcharstr sDEVICE lt device gt Select the initial output device driver sFONTMAP lt filenamel gt lt filename2 gt Defines one or more file names for the font file mapping table a Several file names are separated by a semicolon under Win a dows and OS 2 and a colon under Unix SFONTPATH lt dirnamel gt lt dirname2 gt Defines one or more directory names to be searched for font aw definitions Several file names are separated by a semicolon an under Windows and OS 2 and a colon under Unix 5 Ghostscript Reference Section 19 5 2 sOutputFile lt filename gt Selects an output file name or pipe If the file name contains the characters d Ghostscript replaces the d
41. ngbatFonts DingbatFonts see use doc 5 Ghostscript Reference Section 20 5 4 As an example the resources below select a resolution of 72 dpi independent of actual screen size and resolution and disable platform fonts Ghostscript useExternalFonts false Ghostscript xResolution 72 Ghostscript yResolution 72 If you want Ghostscript to use the same resource settings every time it s best to put the resources into a file and load it with the xrdb program Configuration Error Messages Ghostscript issues the usual PostScript error messages see Chapter 2 Additionally there are some messages relating to Ghostscript installation or configuration errors instead of Post Script errors undefinedfilename in Fontmap Ghostscript can t find the Fontmap file and the GS_FONTPATH environment variable isn t set Install a Fontmap file or set GS_FONTPATH to point to an appropriate font directory Can t find or open initialization file gs_init ps Ghostscript can t find its main initialization file Use the I op tion or the GS_LIB enviroment variable to point Ghostscript to the directory containing the gs_ ps files Can t find or can t open font file xxx The Fontmap file contains a font file entry for a nonexistent file or a file that Ghostscript can t open Under Unix check the file permissions Substituting font Courier for xxx Ghostscript can t find a requested font and substitutes for it with a
42. nother font Processing continues Unable to load default font xxx Giving up Ghostscript can t find the default font file and hence isn t able to do text output at all Therefore processing stops Check the font configuration Ghostscript User Manual Can t find library libXt so 6 Unix versions of Ghostscript generally are linked dynamically For this reason several libraries must be accessible at runtime Use the Idd command to find out which libraries are needed lo cate these on your hard disk and set the LD_LIBRARY_PATH environment variable appropriately Another solution is to link Ghostscript statically Unknown device xxx Ghostscript has been launched with an unknown device driver name If you want to use drivers which are not available in the standard configuration you have to recompile and link Ghost script with the necessary drivers gs Interpreter revision 401 does not match gs_init ps revision 353 Ghostscript found an initialization file that doesn t match the program version Make sure the GS_LIB environment variable or the I command line option don t point to an obsolete Ghost script version on your hard disk 6 More Ghostscript Applications Many file format conversions and other special applications are possible with the help of Ghostscript drivers and auxiliary pro grams Some of these applications are not PostScript interpreter tasks at first sight The descriptions in the following
43. ntation Use smaller resolution if you want to see the entire page at a time without scrollbars With the Media menu you can adjust the page size media format Installing Ghostscript manually If you don t use Win dows don t need GSview or can t stand setup programs you can install Ghostscript manually All of the files contained in the archive gs401ini zip plus one of the executables listed in the ta ble above are necessary for using Ghostscript However the CD ROM already contains complete file sets excluding fonts in the directories dos win win32 and os2 To install Ghostscript simply copy the files from the suitable directory on the CD ROM to a directory on your hard disk e g C gs To use the 32 bit version for Windows 3 x you need the win32s system extension in addition to the Ghostscript files Win32s can be found on the CD ROM in the tools win32s windows directory and has to be installed separately Note many software pack ages use win32s so it may already be installed on your system If you re short on disk space you can run Ghostscript direct ly from CD ROM The MS DOS version of Ghostscript uses the environment variable GS_LIB to locate the initialization files if they cannot be found in the current directory or the standard directory c gs It s best to include the following statements in your autoexec bat file assuming you installed Ghostscript in d progs gs 2 Installing Ghostscript Con
44. ons will be lifted in the future PDF files and GSview Ghostview Note that because of the idiosyncrasies of the PDF format Ghostscript isn t able to read PDF files from its standard input Due to this fact displaying PDF files with Ghostview has its limitations You can use the following command line for Ghostview on Unix to browse PDF files one page after the other It s not possible to jump to arbi trary page numbers ghostview arguments file pdf quit ps GSview for Windows and OS 2 has already been adapted to processing PDF files GSview handles PDF files just as PostScript files Jumping to an arbitrary page in the file is also possible Extracting text from PDF files Using the ps2ascii ps or pstotext utilities you can extract text from PDF files see below for details 6 3 Printing and Extracting Text Printing text files The gslp ps utility program implements a lineprinter emulation i e printing simple text files with Post Script commands This includes some formating such as head ers and footers page numbers and tabs Ghostscript optionally creates PostScript code or renders the text on screen or printer Details on using the emulator and possible options may be found in the gslp ps file Example for printing a text file on a la serjet printer gs q sDEVICE laserjet r300 dNOPAUSE gslp ps file txt 6 More Ghostscript Applications 23 You may use several options following the file name gslp ps The
45. ostscript from C Source 13 List of Ghostscript drivers available with version 4 01 PCX 4 bits color PCX 8 bits color PCX 24 bits color PDF Portable Document Format Plain bits raw format monochrome Plain bits raw format RGB Plain bits raw format CMYK PBM Portable Bitmap ASCII format PBM raw format PGM Portable Graymap ASCII format PGM raw format PGM optimizing to PBM ASCII if possible PGM optimizing to PBM raw if possible PNG Portable Network Graphics monochrome PNG Portable Network Graphics 8 bits gray scale PNG Portable Network Graphics 4 bits color PNG Portable Network Graphics 8 bits color PNG Portable Network Graphics 24 bits color PPM Portable Pixmap ASCII format RGB PPM raw format RGB PPM optimizing to PGM ASCII or PBM ASCII if possible PPM optimizing to PGM raw or PBM raw if possible PostScript Level 1 monochrome bitmap SGI RGB pixmap format TIFF b w CCITT RLE 1 dim fax group 3 without EOLs TIFF b w fax group 3 with EOLs TIFF b w fax group 3 2 D TIFF b w fax group 4 TIFF b w LZW compression tag 5 TIFF b w PackBits compression tag 32773 TIFF 12 bit RGB color no compression TIFF 24 bit RGB color no compression Ghostscript User Manual pex16 pcx256 pex24b pdfwrite bit bitrgb bitcmyk pbm pbmraw pgm pgmraw penn pgnmraw pngmono prggray pngl6 png256 pngl6m ae ppmraw pnm pnmraw psmono sgirgb tiffcrle tiffg3 tiff
46. ource and use the pre compiled binary instead you have to adapt the makefile Change the following line in the makefile near the end of the file install exec GS to 2 Installing Ghostscript 7 2 4 install exec By default the installation process copies files to the directories usrflocal bin and usr local share ghostscript 4 xx If necessary you can change these in the makefile too variable prefix Now install the files with the command make install with root permission You can delete the directory gs4 xx after wards To finish the installation install the Ghostscript fonts as described in the next section Ghostview installation Like Ghostscript Ghostview may be compiled from C source or installed from one of the precom piled versions on CD ROM To use one of these copy the exe cutable program and the X resource file to a suitable directory on disk On Linux for example use the following commands to install the CD ROM version install s cdrom software ghostv linux ghostv usr X11R6 bin ghostview install m 0444 cdrom software ghostv linux ghostv ad usr X11R6 1ib X11 app defaults Ghostview Font Configuration This section applies to all operating systems except Macintosh Font configuration for the Mac differs from other systems and has been covered with the Mac installation already To apply the following description for Unix you have to adapt the syntax for environment variables
47. parator instead of the semicolon A typical hard disk installation on MS DOS or Windows uses the following set GS_LIB C gs C gs fonts or on Unix set GS_LIB usr local share ghostscript fonts export GS_LIB Each directory in GS_LIB may contain the Fontmap file which defines the relation between font names and file names To add new fonts simply add a line similar to the following at the end of the Fontmap file Fontname filename The file name in parentheses must be found in one of the font directories In many cases you can save yourself the trouble of entering font and file names because there are prebuilt Fontmap files for several systems and font configurations If you use one of the following simply copy the appropriate file to the name Fontmap File name Origin of fonts name of operating system Windows with standard ATM fonts Adobe Type Basics font package URW fonts standard fontmap OS 2 with integrated ATM DEC OSF I with DPS Fontmap atm Fontmap atb Fontmap gs Fontmap os2 Fontmap osf 2 Installing Ghostscript 8 File name Origin of fonts name of operating system Fontmap sol Solaris 2 3 and higher with DPS Fontmap ult Ultrix 4 3 and higher with DPS Fontmap vms VAX VMS with DECwindows Motif and DPS In order to let Ghostscript access the fonts in Display PostScript systems you have to include the appropriate path name in GS_LIB A list of these quite varying path names can be found
48. pt distribution contains makefiles for the Mi crosoft Borland Watcom and other C compilers see make doc For example to create the 32 bit Windows version 3 Building Ghostscript from C Source 10 of Ghostscript using the Borland Compiler you first have to create the makefile echo include bcwin32 mak gt makefile Next you can change some settings in bewin32 mak e g com piler and Ghostscript paths optimizations for 386 486 CPUs or FPU assembler accelerator modules or debugging options Fi nally launch make In an intermediate step you have to manual ly start the Windows program genarch to create a system specific include file Compiling on Unix Decompress the C source for Ghost script and the JPEG PNG and ZLIB libraries from the com pressed tar archives into a suitable directory The tar commands creates the gs4 xx directory and three subdirectories gunzip c cdrom software gs compress gs4xxsrc tgz tar xvf cd gs4 xx gunzip c cdrom software gs compress jpeg_6a tgz tar xvf gunzip c cdrom software gs compress lpng089c tgz tar xvf gunzip c cdrom software gs compress zlib102 tgz tar xvf mv libpng 0 89c libpng mv zlib 1 0 2 zlib The mv commands are necessary because the tar archives in clude directory names containing the version numbers The Ghostscript distribution contains makefiles for several op erating systems and compilers ANSI C Kernighan amp Ritchie and GNU C C
49. pt file using File Print In the subsequent menus you can select printer driver resolution if the printer supports multiple reso lutions and in the case of DSC compatible files the page range you want to print When Ghostscript has finished pro cessing the file you can select the printer interface for forward ing the data in a dialog box Printing on Windows 95 and NT For the newer systems of the Windows family you can use the methods described above for MS DOS and Windows 3 x Additionally you can select a printer queue using its UNC name gswin32 q dNOPAUSE sDEVICE ljet4 file ps sOutputFile spool lt printer name gt c quit This spools the printer data to the given printer queue Using the sOutputFile spool option instructs Ghostscript to present a dialog box in which you can select the desired printer queue or interface Printing on Unix In Unix it s possible to integrate Ghost script in the printing process seamlessly However some expe rience with Unix systems administration is required The vari ety of available Unix derivatives doesn t really simplify the task of describing the integration of a PostScript emulation for print ers The following notes are not supposed to be a complete de scription but should help you get started Assuming other system components especially spooler and backend are already set up correctly and are able to transfer bi nary data to the print
50. ram manager and File Run Additional features of GSview GSview offers many addi tional Ghostscript functions which are described in several chapters of this book This includes dealing with EPS files ran domly accessing the pages of DSC Document Structuring Con ventions conforming PostScript files extracting selected pages to print parts of a document only copying the bitmapped page contents to the clipboard or selecting printer drivers in a conve nient manner GSview uses temporary files for printing and for extracting text These temporary files are normally created in the directory specified in the TEMP environment variable A warning will be Ghostscript User Manual given if the TEMP variable is not set The TEMP variable must therefore point to a writable directory on disk if GSview is run directly from CD ROM 2 2 Installation on the Macintosh Requirements and versions Ghostscript for the Macintosh is called Mac GS Viewer It s available in three versions one for Macs with Motorola CPU 68020 and higher a native version for PowerPC s and a version for Mac Classics with 68000 CPU min 3 MB available memory The installation needs approxi mately 6 MB disk space including fonts Mac GS viewer is based on Ghostscript 3 33 Contrary to Windows and OS 2 there is no equivalent of GSview for the Mac Fortunately this deficiency is compensated for by several extensions in Mac GS Viewer and its user inte
51. ram would need far too much memory For this reason the standard configuration for each platform contains only the most important screen printer and file format drivers for the respective platform You can check the list of available Ghostscript drivers using the command line gs You can also obtain the driver list with the following com mands at the Ghostscript prompt devicenames or devicedict pop forall If you want Ghostscript to use a driver for which C source is in cluded in the distribution but which is not compiled into the ex ecutable by default you have to build your own version by us ing a modified makefile Many Ghostscript drivers have been contributed by users and later became part of the Ghostscript distribution If you want to write a new driver read the remarks on Ghostscript driver interaction in drivers doc In addition to the file format drivers listed in the table below previous Ghostscript versions contained one for the GIF graph ics format In reaction to the licensing problems around the LZW compression technique used in GIF Peter Deutsch dropped support for this format from the Ghostscript distribu tion If you have to create GIF files you can integrate the GIF driver from an older release However it s easier to render to another graphics file format e g TIFF or PBM and convert it to GIF The table below lists all display printer and file format driv ers available for Ghostscript
52. rectory etc Ip fd and create a file for the printer say ljet_ps fd Input types postscript ps Output types simple Command usr local bin gs sDEVICE ljet4 q sOutputFile Integrate this filter in the spool system lpfilter f ljet_ps F etc lp fd ljet_ps fd To print a PostScript file simply declare the file type on the command line lp T postscript tiger ps For serial connections make sure the backend doesn t change the printer data by using the stty options opost cs8 parenb 4 Ghostscript Primer 16 4 3 Ghostscript as Viewer for a WWW Browser World Wide Web browsers and many E mail programs classify files according to MIME types Multipurpose Internet Mail Exten sion PostScript files use a MIME type of application postscript MIME types and corresponding viewers are generally config ured in a configuration file or menu The details vary according to the particular program Let s take a look at the Windows ver sion of the well known Netscape WWW browser as an exam ple gt Launch Netscape Navigator gt Choose Options General Preferences and the sub menu Helpers gt For the MIME type application postscript enter ai ps eps in the extensions field if the entry doesn t exist already Check Launch the Application for Action and enter the path of GSview Ghostview oder Mac GS Viewer as appropriate e g c gs gsview32 exe gt Click OK and
53. rface You can find the following com pressed archive files on the CD ROM gs_files hgx init files and documentation gs_68k hqx executable for 68020 CPU and higher gs_ppe hqx executable for PowerPC gs_class hqx executable for Mac Classic gs_fonts hgx standard fonts for Ghostscript gsmacsre hqx Mac specific C source files for Ghostscript File Edit Ghostscript Devices Fig 3 File font from n0210031 gsf 1689900 380779 1300076 16056 1 done se newwindow Quadretto IU Lavori Toamy Ghost 2 Installing Ghostscript Mac GS Viewer displays the tiger test page You can enter PostScript commands in the console window and open files via 5 To install Mac GS Viewer you need the program Stuffit Expand er which is not included on the CD ROM Decompress the ar chive gs files hqx This places the contents of this archive in the Ghostscript folder Decompress one of the executable files gs_68k hqx gs_ppc hqx or gs_class hqx along with the Ghost script fonts from the archive gs fonts hqx into the same folder The archive gsmacsrc hqx is only needed for compiling an indi vidual version of Ghostscript Launching and testing Ghostscript Launch Ghostscript by double clicking on the Mac GS Viewer icon After initializa tion the console window Talk to Ghostscript will appear with the Ghostscript prompt GS gt Although you can type in PostScript commands in the console window it
54. rouped objects in the converted AI files 6 2 PDF Files Displaying and printing PDF files You can list PDF files on Ghostscript s command line just like you can PostScript files because Ghostscript recognizes PDF files automatically In or der to be able to process PDF files Ghostscript must be config ured with the PDF interpreter By default this is true on all 32 bit systems except the Macintosh Ghostscript interprets the printable contents of PDF files only and ignores hypertext ele ments such as links annotations and bookmarks and thumb nails Although there is no font substitution with Multiple Mas 6 More Ghostscript Applications 22 ter fonts Ghostscript replaces a missing font with a similar one and adjusts the metrics of the substituted font to those of the missing font Contrary to PostScript files it s possible to access random pages of PDF files Therefore you can select a page range for PDF files when launching Ghostscript gs dFirstPage lt n gt dLastPage lt m gt file pdf This works for displaying and printing PDF files and for con verting them to PostScript see below Converting PDF files to PostScript Ghostscript is able to convert PDF files back to PostScript Level 2 In fact if the PDF file doesn t contain compressed raster graphics or color spaces the generated PostScript files use Level 1 only The following command line creates the corresponding PostScript file for a PDF file
55. sections provide a summary of the most important of these applications Usually you can find more detailed information in the appro priate documentation or source files txt ps c 6 1 Graphics File Formats Displaying and printing graphics file formats The utili ty programs viewgif ps viewjpeg ps viewpbm ps and view pcx ps written in PostScript display or print raster graphic files in the GIF JPEG PBM or PCX file formats without con verting them to PostScript Launch Ghostscript with the appro priate utility and load a graphics file using one of the proce dures viewGIF viewJPEG viewpbm or viewpcx e g gs viewjpeg ps GS gt file jpg viewJPEG 6 More Ghostscript Applications 21 Converting PostScript to raster graphics formats Several file format drivers enable Ghostscript to convert Post Script files to TIFF PBM PCX BMP etc given the appropriate driver has been compiled into the Ghostscript executable The Ghostscript call contains the name of the driver and optional ly the resolution For example to create a 600 dpi bitmapped TIFF version of a file use the following command gs sDEVICE tiffpack r600 sOutputFile page d tif file ps c quit Ghostscripts replaces the d variable in the filename with the actual page number pagel tif page2 tif etc By default the TIFF drivers use a resolution of 204 x 196 dpi standard fax res olution Enhanced rendering with anti alias
56. skJet 500C not for 550C 560C alternate driver HP DeskJet 500C b w also for DeskJet 510 520 540C HP DeskJet 550C 560C HP LaserJet HP LaserJet Plus HP LaserJet Id IIp III with TIFF compression HP LaserJet III with delta row compression HP LaserJet ID with duplex function HP LaserJet 4 600 dpi HP LaserJet 4 with Floyd Steinberg dithering HP PaintJet XL HP PaintJet XL alternate driver HP PaintJet XL color printer HP PaintJet XL color printer alternate driver HP PaintJet XL 300 color printer also for PaintJet 1200C HP 2563B line printer IBM Proprinter 9 pin IBM Jetprinter inkjet color printer Modell 3852 Ghostscript User Manual bjc800 lbp8 lips3 cp50 la50 la70 la70t la75 la75plus 1j250 declj250 In03 ap3250 epson eps9mid eps9high epsonc stcolor st800 dnj650c deskjet djet500 cdeskjet cdjcolor cdj500 djet500c cdjmono cdj550 laserjet Ijetplus ljet2p ljet3 ljet3d ljet4 lj4dith pi pjetxl pjxl paintjet pjxl300 1p2563 ibmpro jetp3852 DWOU OW DWO OW DWO OW WOM wo DWOU DWOU DWOU DWOU OW DWOU DWOUM DWOU DWOU DWOU DWOU pwou DWOU DWOU wou DWO OW List of Ghostscript drivers available with version 4 01 Imagen ImPress C Itoh M8510 Microsoft Windows system printer driver DDB Microsoft Windows system printer driver DIB Mitsubishi CP50 color printer NEC P6 P6 P60 360 x 360 DPI OCE 9050 Okidata IBM compatible dot matrix printer Okidata MicroLin
57. so allowed in this environment variable Ghostscript User Manual TEMP lt directory gt Directory name for temporary files On Windows and OS 2 this variable must point to an existing directory in order to have the printing feature work properly DOS 4G quiet Suppresses the usual startup message of the DOS extender for the 386 MS DOS version 5 3 X Window System Resources Ghostscript evaluates several X resources under the program name ghostscript and the class name Ghostscript You can use X resources to define user preferences or to activate bug workarounds for several X servers In the use doc file you can find more information on resources The table below lists all re sources together with their default values Name Class Default value background Background white foreground Foreground black borderColor BorderColor black borderWidth BorderWidth 1 geometry Geometry NULL xResolution Resolution calc from screen size yResolution Resolution calc from screen size useExternalFonts UseExternalFonts true useScalableFonts UseScalableFonts true logExternalFonts LogExternalFonts false externalFontTolerance ExternalFontTolerance 10 0 palette Palette Color maxGrayRamp MaxGrayRamp 128 maxRGBRamp MaxRGBRamp 5 maxDynamicColors MaxDynamicColors 256 useBackingPixmap UseBackingPixmap true useXPutImage UseXPutImage true useXSetTile UseXSetTile true regularFonts RegularFonts see use doc symbolFonts SymbolFonts see use doc di
58. tScript interpreter together with suitable drivers and utilities makes it possible to carry out many of the operations covered in this book These include displaying graphics files in the formats GIF JPEG or PBM extracting textual data from PostScript or PDF files ras terizing PostScript to raster graphics formats such as TIFF PBM PNG converting EPS graphics to the editable Illustrator format and many other useful features License conditions for the end user Although Ghost script is available free of charge it is still subject to certain license conditions These are always contained in the Ghost script program package Until 1994 Ghostscript was subject to the GNU Public License GPL Under the terms of this license the originator retains the copyright for his work The use and Ghostscript User Manual further distribution of the program however are not restricted significantly Starting with version 3 0 in 1994 Peter Deutsch re placed the GPL with the more restrictive Aladdin Ghostscript Free Public License AGFPL Under the terms of the AGFPL no payment is required for private and commercial use of the program The sale of Ghostscript is explicitly prohibited how ever Exempted from these conditions are BBSs or servers for which users pay access fees independent of the downloaded software and CD ROMs whose contents may be reproduced and distributed without any payment involved Anyone inter ested in commercially lic
59. tscript make txt notes on compiling Ghostscript other txt additional documentation on special topics public Aladdin Ghostscript Free Public License licensing conditions all Unix style manual pages c h asm source files mak def auxiliary files for building the program aE Ka TRN TE sh bat scripts and batch files used in the build process several special appli cmd cations of Ghostscript gs_ ps initialization files for Ghostscript pdf_ ps initialization files for the PDF interpreter other ps auxiliary PostScript files and sample programs Fontmap Fontmap files for several systems Compiling the Standard Version Requirements To build Ghostscript you need approximate ly 15 MB disk space The source is written in ANSI C suited for most current C compilers However you can also use an old Kernighan amp Ritchie compiler The auxiliary program ansi2knr converts the source files to K amp R syntax before compilation An other auxiliary program called genarch automatically creates an include file which describes hardware and compiler architec ture This includes bit and byte ordering word size and other system specific information Ghostscript can be compiled on MS DOS Windows OS 2 Amiga many Unix systems Macin tosh and VMS The C source is highly portable so compiling it on new systems shouldn t be much of a problem Ghostscript User Manual Makefiles The compilation process is controll
60. with the actual page number and creates one file for each page e g page od prn yields pagel prn page2 prn and so on On OS 2 Windows 95 and Windows NT you can use printer queue names sOutputFile spool printername sends the output to the named printer queue If the printer name is miss ing Ghostscript prompts for the name of the connected print er Windows or uses the default queue OS 2 On Unix you can also redirect the output to another pro gram via pipe sOutputFile 1p The special name for the output file instructs Ghostscript to send the data to its standard output sPAPERSIZE lt papersize gt Selects a page size e g a4 The file gs_statd ps contains a list of supported page size names sPSFile lt file ps gt Defines the output file name for PDF to PostScript conversion sSUBSTFONT lt fontname gt Selects the named font as substitute for all missing fonts This disables Ghostscript s normal font substitution mechanism Environment Variables GS_DEVICE lt device gt Defines the initial output device driver GS_FONTPATH lt path gt Specifies a list of directories that should be scanned for fonts at startup see section 2 4 Font Configuration lt GS_LIB lt path gt Search path for initialization and font files GS_OPTIONS lt options gt Defines a list of command line arguments to be processed be fore the ones specified on the command line All command line options are al
Download Pdf Manuals
Related Search
Related Contents
Feature Guide - RelayClinical Record - RelayHealth Sorensen SG Series Power Supply Datasheet - Dataman Programmers Ltd. catalog Bedienungsanleitung - CONRAD Produktinfo. 2004 Infiniti G35 Coupe/Sedan frenos RZMB18Y User Manual Samsung BCD-212AN 用户手册 ChargePro Installation Manual - Spanish Copyright © All rights reserved.
Failed to retrieve file