Thread View: gnu.ghostscript.bug
1 messages
1 total messages
Started by Brett Harper
Thu, 10 Sep 1992 14:24
How to use GhostScript in batch mode?
Author: Brett Harper
Date: Thu, 10 Sep 1992 14:24
Date: Thu, 10 Sep 1992 14:24
66 lines
3154 bytes
3154 bytes
Greetings,
This may not be the right place for questions about Ghostscript, but
I didn't see any group that did, so here goes:
I am using Ghostscript to generate rasterized representations of Postscript files
for a page layout sorta application (and, I might add, it works great!). The output
drivers I am using are the pcx drivers (mono and 256) and having the output go to stdout.
I invoke gs with a command like:
echo "($1) run" | gs -DNOPAUSE -q -DERR -sDEVICE=pcx256 -sOUTPUTFILE=\|/bin/cat -
where $1 = .ps filename
The -q and -DNOPAUSE options work well to keep regular messages from appearing in
the output stream. But the problem arises when I get error messages from gs. They
print to stdout. The non-standard option -DERR above is my attempt to still get the
error messages, while keeping them out of stdout. Basically what that option does is:
currentdict /ERR known /ERR exch def
% If special flag 'ERR' is given create a error file
% for reporting errors.
ERR {
/.stderr (/tmp/GS_errors.txt) (w) file def
/.stdout (/tmp/GS_output.txt) (w) file def
/print {.stdout exch writestring .stdout flushfile} def
/eprint {.stderr exch writestring .stderr flushfile} def
} if
(Notice the lame hardcoded error message files!)
If the error flag is set, then create two files (.stdout, and .stderr) and redefines
the print function (operator? I am a real GhostScript (that language that bears
remarkable similarities to P*stScr*pt) novice).
I redefine the print operator because some routines still use it even when -q is given.
I also define a special version of print (eprint) that I use in the errorhandler
so that I can get a report of the errors that happen without having other output mixed
in. (I also had to change the ==only procedure to output to .stderr, to get the error
reports to look good, even though I know this is probably not what I want to do in general)
Well now that I have wheezed on about this long enough, I ask:
"How do others handle this?" I.e.
. Run GhostScript in a sorta batch mode,
. Get rasters down stdout,
. While getting errors along some other path.
Or, am I going about this all wrong, since my application is X-based, should
I try to leverage the GhostView hooks for writing directly to a shared Pixmap?
What sort of success can I expect with this method?
I don't think I would be able to use the GhostView widget directly however.
Any help (of any sort, even your experiences with using GhostScript in this way)
would be greatly appreciated!
p.s. I am using version 2.4.1, should I get gs2.5?
Thanks,
Brett Harper
brett.harper@cimlinc.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads