Re: gsapi_set_stdio() and -OutputFile=-

Chris Liddell <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.devel
Message-ID <[email protected]>
On 25/03/16 14:30, Hartmut Goebel wrote:
> HI,
> 
> I'm the developer of python-ghostscript, an interface to use the
> ghostscript api from Python. ATM I try to complete a test-suite. And I'm
> failing to redirect stdout using gsapi_set_stdIO(). Unfortunatly
> gsapi_set_stdIo is not well documented.
> 
> The output-device I'm using is bmp16.
> 
> If passing -OutputFile=-, the image data is written to the stdout
> instead of being passed to the stdout-function I've set with
> gsapi_set_stdio().
> 
> And when leaving -Outputfile away, I get the error:
>    GPL Ghostscript 9.14: Could not open the file .
>    GPL Ghostscript 9.14: Unrecoverable error, exit code 1
> 
> 
> On IRC, Robin Watts already answered:
> 
>> That doesn't entirely surprise me.
> 
>> This is *not* my area really, but I thought that the purpose of the
> stdout redirection was so you could redirect the backchannel stuff from
> postscript.
> 
>> When you use -OutputFile=- that's an instruction to the device, so a
> different kettle of monkeys.
> 
> 
> So is there some way to make the bmp16-device to use the stdout_fn?
> Or which other device should I use?
> If this does not help, I'd need some other test, eg. a small postscript
> file writing "Hello World" to stdout. Any idea for this?

Robin is entirely correct, that cannot work (the device API does not,
and cannot use the Postscript stream redirection), and wouldn't do you
any good anyway, since you'd get text backchannel messages mixed in with
the binary output. I will document this restriction when I get a moment.

If you give some idea what you are trying to achieve, we might be able
to offer an alternative approach.

Chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.