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 3430 articles. 0 followers. Post

4 Replies
184 Views

Similar Articles

[PageSpeed] 48


  • 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 ...

Re: How to convert all the xpt files in a folder to sas datasets #5
I don't think CIMPORT works on files created with the XPORT engine. On 10/22/07, Joe Whitehurst <joewhitehurst@gmail.com> wrote: > 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...

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 #9
I do not know how those .xpt files have been genrated. Do think there is way to find how they are created and why is that Problem is caused. thanks On 10/23/07, data _null_, <datanull@gmail.com> wrote: > > This technique is documented at support.sas.com as... > > Sample 25978: Shortcut to importing multiple transport files created > by the XPORT engine > > > However, Kumar wrote to me off list that it does not work for his > XPORT engine files. He sent three of them to me to test and they > don't work for me either. By not work I mean only one outp...

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

Re: How to convert all the xpt files in a folder to sas datasets #8
This technique is documented at support.sas.com as... Sample 25978: Shortcut to importing multiple transport files created by the XPORT engine However, Kumar wrote to me off list that it does not work for his XPORT engine files. He sent three of them to me to test and they don't work for me either. By not work I mean only one output file is created as the concatenation off all input files. 105 proc copy in=in out=work; 106 run; NOTE: Input library IN is sequential. NOTE: Copying IN.AE to WORK.AE (memtype=DATA). NOTE: BUFSIZE is not cloned when copying across different engines. ...

How to convert all fig files in a folder to svg using plot2svg from msdos?
I have many fig files with random names (say ps.fig, vdc.fig etc) in a folder. I want to convert all of them in to svg files (with names say ps.svg, vdc.svg etc) using plot2svg. And I want to do it from windows command window using a batch file. @ECHO OFF ECHO We will convert matlab figure files to svg files now! CD /D %~dp0 SET Program="matlab.exe" %Program% -nodesktop -nosplash -r fig2svg.m Since -r directive takes only one argument, I need to write a script file. The script should open each fig file one by one and operate plot2svg on each of them and save them with the...

Re: How to convert all the xpt files in a folder to sas datasets #7
Dear SAS-L-ers, The intrepid SAS Learner posted the following: > %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...

Re: How to convert all the xpt files in a folder to sas datasets #6
Data, I think you are correct. I did not notice that the poster specified how the xpt files were created. Joe On 10/22/07, data _null_, <datanull@gmail.com> wrote: > > I don't think CIMPORT works on files created with the XPORT engine. > > On 10/22/07, Joe Whitehurst <joewhitehurst@gmail.com> wrote: > > 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: >...

Re: How to convert all the xpt files in a folder to sas datasets #3
Mr. Learner; I wouldn't suggest macro for this task ... unless it's more complicated than you are letting on. Assume, for the sake of word wrapping in this email, that the transport files are in Z:\Develop\xpt. You can get the list of files with the PIPE engine, and you can use CALL EXECUTE to submit your code for execution after the DATA step finishes running. Libname raw_sets "Z:\Develop\data\" ; FileName cmd pipe 'dir "Z:\Develop\xpt" /a:-d-h-s /b' ; Data _null_ ; InFile cmd ; Input ; If ( upcase( scan( _inFile_ , -1 , '.' ) ) eq...

Re: How to convert all the xpt files in a folder to sas datasets #2
Of course you can use a FILENAME with PIPE to determine the names of the files that you need to read. However it occurred to me that a wild card in a LIBNAME might also work. I tried it and it does. This will replace your entire macro with piped file names with a libname for the input and libname for the output. Followed by PROC COPY. /* create some xport libraries*/ libname x1 xport 'dm.xpt'; libname x2 xport 'ae.xpt'; data x1.dm; set sashelp.class; run; data x2.ae; do x=1 to 100; output; end; run; /*read them all with wild card*/ libname raw_xp...

make a folder to .nsi file(which finally will convert to .exe) use python
Has any python liberary can make a folder to .nsi file? Thanks ...

Windows converted folder to file!! Damn!! Who is familiar w the problem ? Sorry Offtopic;-((
Hello I apologize for the offtopic but I just dont know where I could write about it. The problem seems a serious one And somebody may well have had the same and could show the direction to seach The problem is that XP has a kind scandisk prog which runs before the system startup if it finds sth wrong with the disk. as a matter of fact it does find sth wrong and on the screen appears : unrecoverable error bla-bla convert folder to file? (the prog asks and it answers itself!!!! YES) so after this there is no more data in the folder that's the result!!! thus the windows destroy...

Open folder, read file, close file, open new folder, read file close file etc....
Hello, My current directory has several folders within it. Each folder has the same type of file within it. How do i go from the current directory, into one of the folders, edit the file, then come out of the folder, then go into another folder, edit a file then come out of the folder then into a new one etc etc etc. If this does not make sense i apologise and will try to explain my problem a little better. Any help would be much appreciated. Cheers, Phil Phil: I'm not sure it makes sense. Personally I use the mouse and keyboard for doing this. Were you thinking of something else?...

Can I get the very same STL file if it is converted to VRML file and then converted to STL file again?
hi, guys I gotta a STL file A.stl. But I think it's too big to email. Then, I convert it to VRML file B.vrml. Finally, I want to use it again as a STL file C.stl. Then, do A.stl and C.stl have the exact precison? (or same geometry information) Actually, I want to use C.stl as the machining model. Therefore, I have to get the exactly same file as A.stl. How about JT file? almost same with VRML? I'm not familar with VRML format. But I'm very interested in it cuz it's much smaller in size than STL format. Thanks a lot, On 9 Sep 2005 14:34:27 -0700, "jave" <jav...

need help, my file folders from external drive and usb drive became exe fileneed help, my file folders from external drive and usb drive became exe file
need help, my file folders from external drive and usb drive became exe file. my avg anti virus can detect it as trojan horse dropper agent.mqp. i dont want to remove the exe file yet because im afraid my files will be removed as well. can anyone give me another way to recover the files? -- wewet ------------------------------------------------------------------------ wewet's Profile: http://forums.techarena.in/members/100316.htm View this thread: http://forums.techarena.in/virus-spyware/1184791.htm http://forums.techarena.in ...

Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same n
Hi, Consider /src/alias/a.c /src/alias/b.c /src/xml/p.xml /src/xml/c.xml /src/h.c as source directory=20 and=20 /dest/alias /dest/xml /dest as destination directory. These are given in a csv file like /src/alias/a.c, /dest/alias /src/alias/b.c, /dest/alias /src/xml/p.xml, /dest/xml /src/xml/c.xml, /dest/xml /src/h.c, /dest Python code should read csv file. Copy files from source to destination(fil= es in /src/alias should be copied to /dest/alias and not to /dest/xml i.e.,= directory names should be the same). If /dest contains same files as /src,= then they code shoul...

How to convert .out file to .mat file?
Hello there... I am doing analysis with wavelet toolbox, i created the fault signal with the PSCAD and save the output signal as .out file. When i want to load the signal into wavelet toolbox in the MATLAB, the signal need to be in .mat file. Anyone know how to change the .out file to .mat file? Thanks Simon ...