Bug 687542 - Print with pswrite gives 'Could not open the file \\spool\yourprinter'
Summary: Print with pswrite gives 'Could not open the file \\spool\yourprinter'
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PS Writer (show other bugs)
Version: 8.11
Hardware: PC OS/2
: P4 normal
Assignee: Russell Lang
QA Contact: Bug traffic
Depends on: 687562
  Show dependency treegraph
Reported: 2004-06-24 08:42 UTC by Daniel Krüger
Modified: 2008-12-19 08:31 UTC (History)
1 user (show)

See Also:
Word Size: ---


Note You need to log in before you can comment on or make changes to this bug.
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

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:
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