|
|
Ghostscript pdfwrite
I am trying to use Ghostscript in Windows to merge multiple PDFs into a
single PDF. The command line I am running is:
gswin32 -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=C:\Temp\tmp323.pdf
-dBATCH C:\Temp\pdf1.pdf C:\Temp\pdf2.pdf
When ghostscript opens, I get the error:
**** Unable to open the initial device, quitting.
If I remove the device name and use the default device, ghostscript
runs successfully and I can see the PDF being generated. My path has
the bin and lib dirs. Running ghostscript reports pdfwrite as one of
the devices that can be used. I have tried setting other environment
variables, such as gs_lib and making sure the temp is to a writable
location.
I've seen others with this issue, but they appear to be using gs,
showing they are using unix instead. I'm not sure why there would be
any difference, but trying to make the changes suggested in those
threads has not helped.
|
|
0
|
|
|
|
Reply
|
smithsj (4)
|
8/30/2006 10:40:45 PM |
|
> I am trying to use Ghostscript in Windows to merge multiple PDFs into a
> single PDF. The command line I am running is:
>
> gswin32 -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=C:\Temp\tmp323.pdf
> -dBATCH C:\Temp\pdf1.pdf C:\Temp\pdf2.pdf
>
> When ghostscript opens, I get the error:
>
> **** Unable to open the initial device, quitting.
>
GSWin32c -dNOPAUSE -dBATCH -sDEVICE=pdfwrite
-sOutputFile="C:\Temp\tmp323.pdf" -c .setpdfwrite -f "C:\Temp\pdf1.pdf"
"C:\Temp\pdf2.pdf"
or
GSWin32c -dNOPAUSE -dBATCH -sDEVICE=pdfwrite
-sOutputFile="C:\Temp\tmp323.pdf" -c .setpdfwrite -f @"C:\Temp\filelist.txt"
where filelist.txt is an ASCII file containing the filenames of the
files that you want to merge
Govert
|
|
0
|
|
|
|
Reply
|
Govert
|
8/31/2006 4:01:24 AM
|
|
> GSWin32c -dNOPAUSE -dBATCH -sDEVICE=pdfwrite
> -sOutputFile="C:\Temp\tmp323.pdf" -c .setpdfwrite -f "C:\Temp\pdf1.pdf"
> "C:\Temp\pdf2.pdf"
I ran this and I'm still getting the same error, 'Unable to open the
initial device, quitting.'
|
|
0
|
|
|
|
Reply
|
smithsj
|
8/31/2006 3:59:08 PM
|
|
<smithsj@adeptivesw.com> wrote in message news:1156977645.202026.127060@74g2000cwt.googlegroups.com...
>I am trying to use Ghostscript in Windows to merge multiple PDFs into a
> single PDF. The command line I am running is:
>
> gswin32 -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=C:\Temp\tmp323.pdf
> -dBATCH C:\Temp\pdf1.pdf C:\Temp\pdf2.pdf
>
> When ghostscript opens, I get the error:
>
> **** Unable to open the initial device, quitting.
You did not specify which version of Ghostscript that you are using. I can get
that error message with an older version (I tried 7.07) if GS cannot open the output
file. Newer versions of GS will tell you if it cannot open the output file.
I suggest that you verify that the directory C:\Temp exists and that you have
write access to the directory. Likewise you could have a problem if c:\Temp\tmp323.pdf
already exists and it is write protected.
|
|
0
|
|
|
|
Reply
|
Dan
|
8/31/2006 5:58:38 PM
|
|
I think I have narrowed this down to a path issue. I simplified the
directories in my post, but once I tried these directories I wrote,
specifically for the output file, the pdf started generating properly.
The double quotes did fix my earlier problem where ghostscript would
report an issue with my path.
It's a good idea to always use double quotes when specifying the path
and filename. Single quotes do not work.
Thanks for the help.
|
|
0
|
|
|
|
Reply
|
smithsj
|
8/31/2006 6:41:02 PM
|
|
smithsj@adeptivesw.com wrote:
> It's a good idea to always use double quotes when specifying the path
> and filename. Single quotes do not work.
That's as as expected, since Ghostscript doesn't break up the
commandline into words itself, but relies on the shell that called it.
On Windows, that's cmd.exe, which only recognizes double quotes (unless
you futz with the registry).
On Linux or Unix, or on Windows under Cygwin's bash, single quotes work.
|
|
0
|
|
|
|
Reply
|
rpresser
|
9/1/2006 2:10:34 PM
|
|
|
5 Replies
1033 Views
(page loaded in 0.155 seconds)
|
|
|
|
|
|
|
|
|