GhostScript - syntax to convert all files in a folder

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hello,

I just downloaded Ghostscript and am trying to figure out how to
convert all of the files in c:\cproofs from PDF to GIF (or JPG if GIF
is not possible).  all I get in resonse to my commands is "Error:
/undefined in GS".  I have about 5000 files I need to convert in that
directoy and dont want to be promted.  I have tried to read through the
docs but I am missing some fundamental port of the process.

Can anyone respond with the correct syntax?

Thanx
Mark

0
Reply byebyemag (6) 11/10/2006 7:13:47 PM

See related articles to this posting

"Koden" <byebyemag@hotmail.com> wrote:

>I just downloaded Ghostscript and am trying to figure out how to
>convert all of the files in c:\cproofs from PDF to GIF (or JPG if GIF
>is not possible).  all I get in resonse to my commands is "Error:
>/undefined in GS".  I have about 5000 files I need to convert in that
>directoy and dont want to be promted.  I have tried to read through the
>docs but I am missing some fundamental port of the process.

GhostScript will do one at a time. Get the syntax right for doing
that, and then write a script/batch file to run it 5000 times.

Above all: gs commands that you see in documentation are DOS commands
for a DOS prompt or script. You do NOT prompt them into GhostScript's
window, this is for typing PostScript commands. You probably don't
want this window, so need to use a different command to run gs.
----------------------------------------
Aandi Inston  quite@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.

0
Reply quite (1321) 11/10/2006 10:58:33 PM

Aandi Inston wrote:
> GhostScript will do one at a time. Get the syntax right for doing
> that, and then write a script/batch file to run it 5000 times.

The time to start up gs is probably pretty significant,
so if it is possible to start gs once and have it do
5000 files, you should win pretty big on total elapsed
time. A script like this ought to work (notice this *is*
ghostscript code, not DOS BAT code). It will not quite
do what you want if the individual pdfs are more than
a single page each; IIRC there is a way to tell
gs to write each page in a separate name.jpgnnn
file, but I'd have to look it up and maybe someone
else remembers how. I'm also just using the defaults
for jpeg resolution, quality, etc. You can specify those
with putdeviceprops too.

Note the doubled backslashes in DOS-style file names.
You might be able to use forward slashes (not doubled);
I don't have a DOS box to try it on.

There isn't a gif device, but are you sure you want
jpeg as the alternative? There are png devices and
gif and png are in the same family of image format;
jpeg is for a different purpose, and won't look very
good unless the pages are really continuous-tone
photographic stuff.

-Chap

% string suffix *ChangeSuffix* newstring
%
% returns a new string the same length as string with the last
% suffix-length bytes replaced with suffix.
% so (foo.pdf) (jpg) ChangeSuffix produces (foo.jpg). Beware this
% assumes the original string ends with a suffix the same length
% as suffix that should be replaced. different behavior could be
% implemented as an exercise.
/ChangeSuffix {
  exch dup length string copy
  dup dup length 3 index length sub 4 -1 roll putinterval
} bind def

(c:\\cproofs\\*.pdf) {
  /PreSave save def
  mark /OutputFile 2 index (jpg) ChangeSuffix
  /jpeg finddevice putdeviceprops setdevice
  run
  PreSave restore
} 128 string filenameforall

0
Reply googrou (113) 11/11/2006 3:07:14 PM

Koden a �crit :
> Hello,
> 
> I just downloaded Ghostscript and am trying to figure out how to
> convert all of the files in c:\cproofs from PDF to GIF (or JPG if GIF
> is not possible).  all I get in resonse to my commands is "Error:
> /undefined in GS".  I have about 5000 files I need to convert in that
> directoy and dont want to be promted.  I have tried to read through the
> docs but I am missing some fundamental port of the process.
> 
> Can anyone respond with the correct syntax?
> 
> Thanx
> Mark
> 
Apparently, you use Windows (c:\proofs).
You can download PDFCreator. It uses Ghostscript as engine and has an
interface to prepare batch processing of different files.
It can help to solve the problem.
Otherwise, a script in python can read files in a directory and process
them with ghosyscript. This second solution can be used on any system.

Regards.

Alain
0
Reply arwebmail (75) 11/13/2006 8:23:02 AM

"Koden" <byebyemag@hotmail.com> wrote in message 
news:1163186027.750789.193520@k70g2000cwa.googlegroups.com...
> I just downloaded Ghostscript and am trying to figure out how to
> convert all of the files in c:\cproofs from PDF to GIF (or JPG if GIF
> is not possible).  all I get in resonse to my commands is "Error:
> /undefined in GS".  I have about 5000 files I need to convert in that
> directoy and dont want to be promted.  I have tried to read through the
> docs but I am missing some fundamental port of the process.
>
> Can anyone respond with the correct syntax?

From a Windows command prompt, try the following
  for %i in (*.ps) do echo %i

Modify as appropriate to call ghostscript instead of "echo %i"


0
Reply gsview2005noyear (18) 11/18/2006 10:42:34 AM
comp.lang.postscript 3469 articles. 0 followers. Post

4 Replies
95 Views

Similar Articles

[PageSpeed] 11

  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

script to convert all files in folder
Is it possible to make a paintshop pro 8.1 script that converts all files (gif/jpg...) into *.png, set the pixel to 200X100 if the size is larger, but leave the size as it is if they are smaller? ans wrote: > Is it possible to make a paintshop pro 8.1 script that converts > all files (gif/jpg...) into *.png, set the pixel to 200X100 if > the size is larger, but leave the size as it is if they are > smaller? Yes. You would probably record a script that does the format change and the resize on one image, then edit it to add the size test, for which you would need to learn a litt...

script to convert all files in folder
Is it possible to make a paintshop pro 8.1 script that converts all files (gif/jpg...) into *.png, set the pixel to 200X100 if the size is larger, but leave the size as it is if they are smaller? ans wrote: > Is it possible to make a paintshop pro 8.1 script that converts > all files (gif/jpg...) into *.png, set the pixel to 200X100 if > the size is larger, but leave the size as it is if they are > smaller? Yes. You would probably record a script that does the format change and the resize on one image, then edit it to add the size test, for which you would need to learn a litt...

Converting file folder contents into hyperlinks
I'm looking for some software that would allow me to point to a folder in Windows Explorer, and have it output an html file with hyperlinks to all of the files within that folder and all of the sub-folders. I have many folders with several dozen files and sub-folders and would like to avoid hand-coding all of the hyperlinks. Does anyone know if such software exists? Thanks in advance. scoop_77 wrote: > I'm looking for some software that would allow me to point to a > folder in Windows Explorer, and have it output an html file with > hyperlinks And this is f...

Ghostscript Converts File on One Platform But Not Another
We are trying to convert and EPS file that has an embedded tiff. It was created in Illustrator10 on Windows. We are using the command 'convert' provided by the ImageMagick suite. From what I read, convert just passes it off to ghostscript acting more like a proxy than anything. If I use convert on a Mac OSX box that has GS 7.05.6 (from the espgs) binary and ImageMagick 5.5.7 binary, the file is converted to a jpeg perfectly. However, if I put the same versions on a x86 RedHatLinux box it errors with: # convert -density 72x72 -geometry 100x100 ept:myeps.eps jpg:myeps.jpg Error: /u...

How to convert all the xpt files in a folder to sas datasets
%Macro ds(ds ) ; Libname Raw_xpt xport "Z:\MNTX\MNTX3301\Phase Forward\SDTM\Draft_17_MNTX3301_Prod\&ds..xpt" access = readonly ; Libname Raw_sets "Z:\Develop\data" ; data &ds ; set raw_xpt.&ds; Run; %Mend ; %ds(ae) ; %ds(am) ; ' ' ' I know this might have been done before by someone I need to get the List of all the datasets in the Folder where .XPT files are located and change them to sas datasets, I am using above code and it is doing what I need to do, but only thing thing is I need to Physically supply List of all the DCM's names to ma...

I need a way to convert a VIDEO_TS folder to a .img file
DVD Imager simply will not run anymore on my computer and I don't know why. I have been using it to produce a .img file to burn onto a DVD. Is there an alternative and if it is complicated how do you use it? -- Robert B. Peirce, Venetia, PA 724-941-6883 bob AT peirce-family.com [Mac] rbp AT cooksonpeirce.com [Office] In article <bob-DF32E7.13310915072007@news.verizon.net>, Robert Peirce <bob@peirce-family.com.invalid> wrote: > Is there an alternative and if it is complicated how do you use it? Toast does it just fine. http://www.roxio.com/enu/products/toast/titan...

Re: How to convert all the xpt files in a folder to sas datasets
Subject: Re: how read *.xpt? information: proc copy xpt files to a libref http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0704B&L=sas-l&P=15209 Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov > -----Original Message----- > From: owner-sas-l@listserv.uga.edu > [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of SAS_learner > Sent: Monday, October 22, 2007 5:01 PM > To: SAS(r) Discussion > Subject: How to convert all the xpt files in a folder to sas datasets > > %Macro ds(ds ) ; > Libname Raw_xpt xport "Z:\MNTX\MNTX3301\Phase > ...

problem converting the postscript file to pdf using ghostscript
i have a post script file which has four pagees three pages are in Potrait and the fourth is landscape when i run command this command "gswin32c -q -dLOCALFONTS -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dAutoRotatePages=/None -sOutputFile=c:\S100834431_GScript_6.pdf -dCompatibilityLevel=1.4 -c ..setpdfwrite -f C:\S100834431.ps" it generates a pdf file i get the first three pages correct but the fourth page which was landscape is not displayed properly pls help me ...

Convert multiple files with same name from fig to jpeg in different folders
Hello! I'd like to convert a multiple files named 'IO curve.fig' to jpegs to put into powerpoint. The different IO curve.fig files are in different folders. Is there a way to batch convert all the files named 'IO curve.fig' from different folders automatically? Thanks! Mike "Michael " <michael-jung@fsm.northwestern.edu> wrote in message <icjiv2$mo9$1@fred.mathworks.com>... > Hello! > > I'd like to convert a multiple files named 'IO curve.fig' to jpegs to put into powerpoint. The different IO curve.fig files are in d...

Re: How to convert all the xpt files in a folder to sas datasets #4
Albus, close Friend et al, Why not use PROC CIMPORT? Am I missing something again? Joe On 10/22/07, Fehd, Ronald J. (CDC/CCHIS/NCPHI) <rjf2@cdc.gov> wrote: > > Subject: Re: how read *.xpt? > > information: proc copy xpt files to a libref > > http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0704B&L=sas-l&P=15209 > > Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov > > > -----Original Message----- > > From: owner-sas-l@listserv.uga.edu > > [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of SAS_learner > > S...