[bug-gs] problem report + workaround for pdfwrite "**** Unable to openthe initial device, quitting."

Ray Johnston ray.johnston@artifex.com
Fri, 21 Mar 2003 16:49:37 -0800


Dear Tony,

The Ghostscript 'pdfwrite' device requires a valid place for temporary
files (as do most devices if the require a 'clist' or display list
when the raster image exceeds the MaxBitmap size).

Please see:

   http://www.artifex.com/gs800/Use.htm#Temp_files

for the description on where GS looks to place temporary scratch files.

The 'pdfwrite' device will not operate without a scratch area.

Regards,
Ray Johnston
Artifex Software Inc.
__________________________________________________________________________

Tony Plate wrote:
> 
> ------------------------------------------------------------------------
> Symptoms:
> 
> "gswin32c.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite ..." reports:
> **** Unable to open the initial device, quitting.
> 
> Other devices, including pswrite work fine in the same environment.
> 
> Problem is that system environment variable TMPDIR points to a non-existent directory.
> 
> ------------------------------------------------------------------------
> Ghostscript version (or include output from "gs -h"):
> 
> 8.00
> 
> ------------------------------------------------------------------------
> Where you got Ghostscript:
> 
> www.ghostscript.com
> 
> ------------------------------------------------------------------------
> Hardware system you are using (including printer model if the problem
> involves printing):
> 
> Compaq EVO W4000
> 
> ------------------------------------------------------------------------
> Operating system you are using:
> 
> Windows2000
> 
> ------------------------------------------------------------------------
> If you are using X Windows, and your problem involved output to the
> screen, the output from running xdpyinfo and xwininfo:
> 
> ------------------------------------------------------------------------
> C compiler you are using, including its version, if you compiled
> Ghostscript yourself:
> 
> ------------------------------------------------------------------------
> If you compiled Ghostscript yourself, changes you made to the makefiles:
> 
> ------------------------------------------------------------------------
> Environment variables:
> 
>         GS_DEVICE
> 
>         GS_FONTPATH
> 
>         GS_LIB
> 
>         GS_OPTIONS
> 
> ------------------------------------------------------------------------
> Command line:
> 
> $ # Fails with TMPDIR pointing to non-existent directory
> 
> $ echo $TMPDIR
> /c/Temp/6
> $ ls -ld $TMPDIR
> ls: /c/Temp/6: No such file or directory
> $ ls -l tmp2.pdf
> ls: tmp2.pdf: No such file or directory
> $ /c/gstools/gs/gs8.00/bin/gswin32c.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=tmp2.pdf c:/cygwin/usr/share/ghostscript/7.05/examples/alphabet.ps
> AFPL Ghostscript 8.00 (2002-11-21)
> Copyright (C) 2002 artofcode LLC, Benicia, CA.  All rights reserved.
> This software comes with NO WARRANTY: see the file PUBLIC for details.
> **** Unable to open the initial device, quitting.
> $ ls -l tmp2.pdf
> ls: tmp2.pdf: No such file or directory
> 
> $ # Runs OK with TMPDIR pointing to existing directory
> 
> $ export TMPDIR=/c/Temp
> $ /c/gstools/gs/gs8.00/bin/gswin32c.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sO
> utputFile=tmp2.pdf c:/cygwin/usr/share/ghostscript/7.05/examples/alphabet.ps
> AFPL Ghostscript 8.00 (2002-11-21)
> Copyright (C) 2002 artofcode LLC, Benicia, CA.  All rights reserved.
> This software comes with NO WARRANTY: see the file PUBLIC for details.
> Loading URWPalladioL-Ital font from C:\gstools\gs\fonts/p052023l.pfb... 1977816
> 680090 1456712 170354 1 done.
> $ ls -l tmp2.pdf
> -rwxrwxrwx    1 tplate   Domain U    13883 Mar 21 13:52 tmp2.pdf*
> 
> $ # Runs OK with TMPDIR unset
> 
> $ unset TMPDIR
> $ rm tmp2.pdf
> $ /c/gstools/gs/gs8.00/bin/gswin32c.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sO
> utputFile=tmp2.pdf c:/cygwin/usr/share/ghostscript/7.05/examples/alphabet.ps
> AFPL Ghostscript 8.00 (2002-11-21)
> Copyright (C) 2002 artofcode LLC, Benicia, CA.  All rights reserved.
> This software comes with NO WARRANTY: see the file PUBLIC for details.
> Loading URWPalladioL-Ital font from C:\gstools\gs\fonts/p052023l.pfb... 1977816
> 680090 1456712 170354 1 done.
> $ ls -l tmp2.pdf
> -rwxrwxrwx    1 tplate   Domain U    13883 Mar 21 13:52 tmp2.pdf*
> 
> $ /c/gstools/gs/gs8.00/bin/gswin32c.exe --version
> 8.00
> 
> ------------------------------------------------------------------------
> URL or FTP location of test files (include the data at the end of this
> form if 500K or less):
> 
> ------------------------------------------------------------------------
> Suggested fix, if any:
> 
> Either create $TMPDIR or print a more informative error message that will allow the user to correct the problem.
> 
> ------------------------------------------------------------------------
> Other comments:
> 
> This problem is very difficult to track down given the error message, and I could find no pages that helped even after much googling (quite a few did mention this error message though, with little resolution of the problem.)  If this bug report were
> just placed somewhere it could be indexed by google, that would probably allieve the problem.