Convert Error /undefinedfilename In
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn ghostscript error /undefined in more about Stack Overflow the company Business Learn more about hiring developers or posting
Ghostscript Command Line
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Ghostscript: “Unrecoverable error: undefinedfilename in setpagedevice” up vote 1 down vote favorite I'm trying to compress pdf files using ghostscript like this: gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -sOutputfile=output.pdf input.pdf I've done this successfully in the past, but for some reason now it won't work. I get the following error: GPL Ghostscript 9.15 (2014-09-22) Copyright (C) 2014 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. **** Unable to open the initial device, quitting. Unrecoverable error: undefinedfilename in setpagedevice Operand stack: true --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- [Edit: I fixed the typo from -SOutputFile to -sOutputFile to avoid this red herring. (But that is what some of the comments/answers are referring to.)] pdf ghostscript share|improve this question edited Dec 13 '14 at 16:25 asked Dec 13 '14 at 0:48 emacsomancer 294314 1 -SOutputFile is incorrect, it should be -sOutputFile. Because you haven't specified an output file, you get an undefinedfilename. Not too surprising :-) I strongly recommend that you don't use -dPDFSETTINGS but instead set the switches you want individually. –KenS Dec 13 '14 at 12:31 1 Sorry for the typo. Unfortunately, even with the correct syntax (-sOutputFile) I still get exactly the same error. –emacsomancer Dec 13 '14 at 16:23 add a comment| 2 Answers 2 active oldest votes up vote 4 down vote accepted This worked for me... gs \ -sDEVICE=pdfwrite \ -dCompatibilityLevel=1.4 \ -dPDFSETTINGS=/printer \ -dNOPAUSE \ -dQUIET \ -dBATCH \ -sOutputFile=output.pdf \ input.pdf Edited by -kp- To spell it out explicitly (and to re-iterate what KenS wrote in his comment): -SOutputFile=... does NOT work -sOutputFile=... is the correct syntax. (Ghostscript command line parameters are ca
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Calling ghostscript http://stackoverflow.com/questions/27454350/ghostscript-unrecoverable-error-undefinedfilename-in-setpagedevice from a script produces error up vote 0 down vote favorite I'm trying to automate some post-processing on scanned PDF documents. One tool I found was ghostscript that would compress the scanned images nicely. However when I try to call gs from inside my python script it fails miserably: Error: /undefinedfilename in (/tmp/step-02-1.pdf) Operand stack: Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push http://stackoverflow.com/questions/20020123/calling-ghostscript-from-a-script-produces-error --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push Dictionary stack: --dict:1164/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)-- Current allocation mode is local Last OS error: 2 GPL Ghostscript 9.05: Unrecoverable error, exit code 1 The command line I'm trying to run is gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/screen\ -dSAFER -dNOPAUSE -dQUIET -dBATCH -sOutputFile=/tmp/step-03-1.pdf\ /tmp/step-02-1.pdf Since this is a python script, I tried both os.system and os.popen to execute it, but to no avail. If I run the above command line from the shell it all works. Any idea where my error could be? python pdf ghostscript share|improve this question edited Nov 16 '13 at 15:35 asked Nov 16 '13 at 15:25 cdecker 1,73632556 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted Well Ghostscript can't find the file, have you tried something simple like 'ls /tmp/step-02-1.pdf' instead of invoking GS ? Does that work ? share|improve this answer answered Nov 16 '13 at 16:03 KenS 15.2k11320 Yes, the file is definitely there. What really concerns me is that when run from the shell, the command runs correctly without any problems. –cdecker Nov 16 '13 at 16:05 I
in your last search results. Bug695184 - Error: /undefinedfilename Summary: Error: /undefinedfilename Status: RESOLVED WORKSFORME Product: Ghostscript Classification: Unclassified Component: http://bugs.ghostscript.com/show_bug.cgi?id=695184 PDF Interpreter Version: 9.14 Hardware: PC Windows 7 Importance: P4 normal Assigned http://imagemagick.org/discourse-server/viewtopic.php?t=8666 To: Ken Sharp QA Contact: Bug traffic URL: Keywords: Depends on: Blocks: Show dependency tree /graph Reported: 2014-04-24 02:07 PDT by Harry McKame Modified: 2014-04-24 07:18 PDT (History) CC List: 1 user (show) chris.liddell See Also: Customer: Word Size: --- Attachments PDF file with problem (4.26 MB, application/pdf) error /undefined 2014-04-24 02:07 PDT, Harry McKame Details screen capture of error message (40.52 KB, image/jpeg) 2014-04-24 02:08 PDT, Harry McKame Details View All Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description Harry McKame 2014-04-24 02:07:37 PDT Created attachment 10849 [details] PDF file with problem The attached convert error /undefinedfilename PDF file file works fine without parameters by causes "Error: /undefinedfilename" when run with the following parameters : "C:\Program Files (x86)\gs\gs9.14\bin\gswin32.exe" "-IC:\Program Files (x86)\gs\gs9.14\lib;C:\Program Files (x86)\gs\gs9.14\fonts" -dNOPAUSE -dBATCH -dSAFER -sDEVICE=jpeg -dEPSCrop -f -q -dTextAlphaBits=4 -dUseCropBox -dDOINTERPOLATE -sOutputFile="%%d.jpg" "Michelin_Dossier de Presse_Commémorations Guerre 14-18.pdf" PDF file and screen capture are attached. Comment 1 Harry McKame 2014-04-24 02:08:21 PDT Created attachment 10850 [details] screen capture of error message Comment 2 Ken Sharp 2014-04-24 04:26:35 PDT It would help a lot if you could try cutting down the parameters to just those which cause a problem. You have specified -dEPSCrop and -dUseCropBox, which doesn't make sense. EPSCrop isn't going to have any effect with a PDF input file, and you shouldn't try to specify multiple crops anyway. You have specified two '%' characters in the -sOutputFile, this will escape the second '%' and cause the output to be written to a single file called '%d.jpg' which almost certainly isn't what you want. You have specified -f without a preceding -c so it has no effect. You don't need to supply these parameters : "-IC:\Program Files (x86)\gs\gs9.14\lib;C:\Program Files (x86)\gs\gs9.14\fonts"
from IM/GS Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?". Post Reply Print view Search Advanced search 4 posts • Page 1 of 1 jonkeegan Permissions problems with files generated from IM/GS Quote Postby jonkeegan » 2007-03-15T08:40:34-07:00 I'm running ImageMagick 6.3.0 and AFPL Ghostscript 8.54 on Mac OS X 10.4, and I'm trying to get Ghostscript working correctly with IM. GS is installed and working, but there is some problem with the install, since the files it generates have the wrong permissions. The directory I am converting these to is set for 777, so isn't a prob with the directory. As a result, when I run the following IM command (which should use GS):Code: Select allconvert 1.pdf 1.jpgI get the following error:Code: Select allError: /undefinedfilename in (/var/tmp/magick-AltCgcLT)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1128/1686(ro)(G)-- --dict:0/20(G)-- --dict:70/200(L)--
Current allocation mode is local
Last OS error: 13
AFPL Ghostscript 8.54: Unrecoverable error, exit code 1
convert: unable to open image `/var/tmp/magick-fAn9bRGU': Permission denied.
convert: no decode delegate for this image format `/var/tmp/magick-fAn9bRGU'.
convert: Postscript delegate failed `1.pdf'.
convert: missing an image filename `1.jpg'.Seems to be unable to read/write to /var/tmp/ , but when I run this via sudo, it works...For the record, there's no problem when i run: Code: Select allconvert 1.jpg 1.gif, and all other IM commands work fine...I've also tried rebuilding both IM and GS multiple times with various options, such as (for IM):Code: Select allsudo ./configure --enable-shared --with-modules=yes --prefix=/usr/local --enable-delegate-build
Any thoughts?Thanks -Jon Keegan Top meatheadmike Re: Permissions problems with files generated from IM/GS Quote Postby meatheadmike » 2007-03-15T10:13:08-07:00 What about /var/tmp? How are your permissions set up there? Top jonkeegan Re: Permissions problems with file