Bug 687542

Summary: Print with pswrite gives 'Could not open the file \\spool\yourprinter'
Product: Ghostscript Reporter: Daniel Krüger <krda79>
Component: PS WriterAssignee: Russell Lang <gsview>
Status: NOTIFIED FIXED QA Contact: Bug traffic <tech>
Severity: normal    
Priority: P4 CC: gsview
Version: 8.11   
Hardware: PC   
OS: OS/2   
Customer: Word Size: ---
Bug Depends on: 687562    
Bug Blocks:    

Description Daniel Krüger 2004-06-24 08:42:55 UTC
Printing of a PDF file or PS file with ljet4 for example to an OS/2 printer
works perfectly.
But if the printer understand Postscript I checked the checkbox 'Postscript
printer', I get the error 'Could not open the file \\spool\Kyocera1 .' and
nothing else happens (Tested in GSView 4.6, but this must also happen if
Ghostscript is started from commandline; if using ljet4 OutputFile is also
\\spool\Kyocera1).

As I've found out the error is created in the file gsdevice.c in the function
gx_device_open_output_file and it's the first eprintf1. positionable is true in
this case.

If I rem out the complete 'if (positionable || ... { ... return code; }' branch,
I get no error while printing to a postscript printer, but nothing happens.
There isn't created any print job.
Comment 1 Daniel Krüger 2004-06-25 02:44:53 UTC
I've tested it ones more on command line with Ghostscript 8.14 on OS/2:
>>>>>
[D:\gs\gs8.14\bin]gsos2 -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=\\spool\
Kyocera1 d:\temp\24eineseite.pdf
AFPL Ghostscript 8.14 (2004-02-20)
Copyright (C) 2004 artofcode LLC, Benicia, CA.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
AFPL Ghostscript 8.14: **** Could not open the file \\spool\Kyocera1 .
Processing pages 1 through 1.
Page 1
<<<<<

Can someone please explain me the context of gx_device_open_output_file(),
positionable and parsed.iodev. The function gp_open_printer() which isn't called
can handle those "\\spool\.." filenames.
Perhaps with this information I can fix it myself.
Comment 2 Russell Lang 2004-06-27 22:41:02 UTC
Does it work if you use "%printer%Kyocera1" ?
If inside a .cmd file, remember to use %%printer%%Kyocera1.
Comment 3 Russell Lang 2004-06-28 02:18:18 UTC
This won't work as is on OS/2.
The pswrite device is not a normal printer device, so doesn't use 
gp_open_printer.  Using "\\spool\printer name" doesn't work with
the pswrite device on Windows, and the same would occur on OS/2.
On Windows, using "%printer%printer name" does work with pswrite.
This %printer% IODevice is not implemented for OS/2.

I'll try to write this code.  Note that my testing facilities
are very limited. My OS/2 computer is old and doesn't have any
printers attached.

Comment 4 Daniel Krüger 2004-06-28 11:42:08 UTC
Thank you for your work.

It's no problem for me to test this new code.

Maybe it's OT here, but I found other bugs in GSView:
there is code in GSView to print multiple copies, but no GUI to change the
number of copies.
I can specify prolog and epilog files for pswrite printing, but these aren't
mentioned nor integrated in the temporary option or PS files.
Comment 5 Birgit Hubatka 2004-07-06 07:32:51 UTC
I've found a solution for OS/2 that doesn't need any C-language skills.
Add the following option for Ghostscript 8.14:
-sOutputFile=lpt1
I assume it to work not only if invoked by GSView but from command line too.

This works perfectly on my eComStation-System with the printer Xerox Phaser 8200B.

While studying the spooler configuration I saw that LPT1 is redirected to the
spooler. So why not telling Ghostscript to send it to lpt1 ?
Comment 6 Russell Lang 2004-07-06 14:54:37 UTC
I've almost finished a patch that implements "%printer%PhysName" for OS/2.
Comment 7 Daniel Krüger 2004-07-07 01:38:50 UTC
To Birgit: I tested -sOutputFile=lpt1 on command line. It really works. But it
has a few drawbacks if used as fixed GS option in GSView. All output goes
immediately to lpt1 even if I want to convert a PS or PDF file to another file
format. Or if there are more printers (in a network) you want to print to.
Everytime the option has to be changed. We also have a Xerox Solid Ink printer
but it is connected to the USB port which is in fact significantly faster than
the parallel port. I don't found a solution to print from command line to that port.

This command line option would be a solution if GSView detects the port to which
the selected printer is connected and print automatically to that port.

To Russel: Thank you for your work. Could I get a test version?
Comment 8 Russell Lang 2004-09-14 14:49:34 UTC
Added %printer% device.  So pswrite now works with
gs -sDEVICE=pswrite -sOutputFile=%printer%physname