Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to run ghostscript on postscript files on RHEL 5.3.
For now, I am just trying to get output to the screen.
(Character ssh window.)
When I write a very simple program, I get no output, and the last line from ghostscript is:
>>showpage, press <return> to continue<<
Pressing return just exits the program.
When I run the examples in /usr/share/ghostscript..., I either get no output or garbage similar to the following:
Loading NimbusRomNo9L-Regu font from /usr/share/fonts/default/Type1/n021003l.pfb... 2490224 1176223 1838308 530771 2 done.
Using NimbusRomanNo9L-Regu font for NimbusRomNo9L-Regu.
(The above is from colorcir.ps, which I assume is supposed to display a colored circle.)
Anyone know what is going on? Does ghostscript require a GUI display?
I think it only requires a GUI is you choose a value
for sDEVICE such as X11. You might typically have
ghostscript output to a file instead of to the GUI with
-sOutputFile=foo.xyz
For printed output (eg to your terminal) choose "standard output".
From the man page:
You can also send output to standard output:
-sOutputFile=-
or
-sOutputFile=%stdout%
Usually only your diagnostic info will go to your terminal.
Thanks for your response. I have already tried the -sOutputFile switch in all the forms you suggest (diskfile, standard output) and still get the same lack of output that I described in my original e-mail.
My expectation is that ghostscript would display on the screen, or dump to a disk file, whatever the commands in my PostScript file dictate.
For example, here is my test file test.ps, which draws a square:
/inch {72 mul} def % Convert inches->points (1/72 inch)
newpath % Start a new path
10 inch 10 inch moveto % an inch in from the lower left
1 inch 0 inch rlineto % bottom side
0 inch 1 inch rlineto % right side
-1 inch 0 inch rlineto % top side
closepath % Automatically add left side to close path
stroke % Draw the box on the paper
showpage % We're done... eject the page
I would expect 'ghostscript -sOutputFile=- test.ps' to draw the box on my character-based terminal, and 'ghostscript -sOutpuFile=dum.out' to send the box to dum.out. Perhaps a GUI terminal or printer is required as output, but then why does ghostscript permit stdout and file output options?
If I use the png16 device, I am able to create an output file and when I point to it with my browser it DOES display what I expect to see.
When I try to use the x11 DEVICE, I get the following:
ESP Ghostscript 815.02: Cannot open X display `(null)'.
**** Unable to open the initial device, quitting.
Running 'startx' produces all kinds of errors. I know that this is unrelated to ghostscript, but do you know what's wrong? Do I need to be on an X windows terminal?
I copied my example gstest.ps directly from a PostScript online tutorial so it may very well be bogus code.
I'm pretty sure that the x11 option requires you to have an X server
running. There might be other options depending on how your ghostscript
was compiled or what libraries you have available.
Type ghostscript --help
and you will get a section that lists
Available devices:
On my system which is a standard redhat enterprise Linux system
there are maybe 150 different options. Included in there is tek4696
which is likely something intended to go to an old tek terminal.
Maybe start googling the terms that might seem similar to your terminal.
Interesting that even though I know I have an X server running the default
output listed is "display". That sounds pretty generic to me.
What do you have for devices when you type ghostscript --help?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.