Ghostscript (PostScript and PDF language interpreter and previewer)
The gs (gswin32c, gswin32, gsos2) command invokes Ghostscript, an interpreter of Adobe Systems' PostScript(tm) and Portable Document Format (PDF) languages.
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
Default output device: x11alpha
gs myfile.ps
Note:- You must set the DISPLAY of the system for X Sessions before reading an postscript of PDF file otherwise it will throw below error:
#> gs sample.ps
GPL Ghostscript 8.62 (2008-02-29)
Copyright (C) 2008 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file COPYING for details.
GPL Ghostscript 8.62: Cannot open X display `(null)'.
**** Unable to open the initial device, quitting.
So first set the display for the X session as below.
#> export DISPLAY=160.46.204.55:87
And then you can open any *.ps file or *.pdf file.
#> gs sample.ps
GPL Ghostscript 8.62 (2008-02-29)
Copyright (C) 2008 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file COPYING for details.
Loading NimbusRomNo9L-Regu font from /usr/share/ghostscript/fonts/n021003l.pfb... 3918104 2019514 6711160 4881780 1 done.
Loading NimbusRomNo9L-Medi font from /usr/share/ghostscript/fonts/n021004l.pfb... 4034352 2203753 6711160 4948707 1 done.
Loading NimbusRomNo9L-ReguItal font from /usr/share/ghostscript/fonts/n021023l.pfb... 4198200 2394929 6711160 4982580 1 done.
>>showpage, press <return> to continue<<
XIO: fatal IO error 104 (Connection reset by peer) on X server "160.46.204.55:87.0"
after 2957 requests (2953 known processed) with 0 events remaining.
prints out
%%BoundingBox: 0 25 583 732
%%HiResBoundingBox: 0.808497 25.009496 582.994503 731.809445
Any questions concerned, please join our Linux Forum.
The gs (gswin32c, gswin32, gsos2) command invokes Ghostscript, an interpreter of Adobe Systems' PostScript(tm) and Portable Document Format (PDF) languages.
- In simple words, it is mainly used to read a postscript file or a PDF file.
- gs reads "files" in sequence and executes them as Ghostscript programs.
After doing this, it reads further input from the standard input stream (normally the keyboard), interpreting each line separately.
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
Default output device: x11alpha
- The interpreter exits gracefully when it encounters the "quit" command (either in a file or from the keyboard), at end-of-file, or at an interrupt signal (such as Control-C at the keyboard).
- Ghostscript may be built to use many different output devices. To see which devices your executable includes, run "gs -h". Unless you specify a particular device, Ghostscript normally opens the first one of those and directs output to it, so if the first one in the list is the one you want to use, just issue the command
gs myfile.ps
Note:- You must set the DISPLAY of the system for X Sessions before reading an postscript of PDF file otherwise it will throw below error:
#> gs sample.ps
GPL Ghostscript 8.62 (2008-02-29)
Copyright (C) 2008 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file COPYING for details.
GPL Ghostscript 8.62: Cannot open X display `(null)'.
**** Unable to open the initial device, quitting.
So first set the display for the X session as below.
#> export DISPLAY=160.46.204.55:87
And then you can open any *.ps file or *.pdf file.
#> gs sample.ps
GPL Ghostscript 8.62 (2008-02-29)
Copyright (C) 2008 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file COPYING for details.
Loading NimbusRomNo9L-Regu font from /usr/share/ghostscript/fonts/n021003l.pfb... 3918104 2019514 6711160 4881780 1 done.
Loading NimbusRomNo9L-Medi font from /usr/share/ghostscript/fonts/n021004l.pfb... 4034352 2203753 6711160 4948707 1 done.
Loading NimbusRomNo9L-ReguItal font from /usr/share/ghostscript/fonts/n021023l.pfb... 4198200 2394929 6711160 4982580 1 done.
>>showpage, press <return> to continue<<
XIO: fatal IO error 104 (Connection reset by peer) on X server "160.46.204.55:87.0"
after 2957 requests (2953 known processed) with 0 events remaining.
- Similarly you can open any pdf file file also but to open PDF its better to use evince command. evince open pdf file page-wise where you can go to next page easily while gs only shows first page.
- Ghostscript can do many things other than print or view PostScript and PDF files. For example, if you want to know the bounding box of a PostScript (or EPS) file, Ghostscript provides a special "device" that just prints out this information.
- For example, using one of the example files distributed with Ghostscript,
prints out
%%BoundingBox: 0 25 583 732
%%HiResBoundingBox: 0.808497 25.009496 582.994503 731.809445
- Ghostscript may be built to use many different output devices. To specify "someDevice" as the initial output device, use the switch
- For example, if you want to send output to an Epson printer you might use the command
Any questions concerned, please join our Linux Forum.
No comments:
Post a Comment