Re: Batch save mode?
- To: mathgroup at smc.vnet.net
- Subject: [mg105131] Re: Batch save mode?
- From: David Reiss <dbreiss at gmail.com>
- Date: Sun, 22 Nov 2009 06:07:41 -0500 (EST)
- References: <he88qf$pu0$1@smc.vnet.net>
Give this a try: It opens up all the notebooks in the source directory and saves them as pdfs in the target directory. the two directories can be the same. David http://scientificarts.com/worklife ClearAll[SaveAsPDFs]; SaveAsPDFs[sourcedir_String, targetdir_String] := Module[{notebooks, nbs, pdfNames, pdfFiles, data, pdfs}, notebooks = FileNames[{"*.nb"}, {sourcedir}]; pdfNames = # <> ".pdf" & /@ (FileBaseName /@ notebooks); pdfFiles = ToFileName[targetdir, #] & /@ pdfNames; nbs = NotebookOpen /@ notebooks; ( SelectionMove[#, All, Notebook]; FrontEndExecute[FrontEndToken[#, "SelectionOpenAllGroups"]] ) & /@ nbs; data = Transpose[{pdfFiles, nbs}]; pdfs = Export[#[[1]], #[[2]], "PDF"] & /@ data; NotebookClose /@ nbs; pdfs ] On Nov 21, 3:36 am, Erik Max Francis <m... at alcyone.com> wrote: > I'm going to be away from my copy of Mathematica for a while and may > potentially want to show the work I've been doing for some friends. I > have several dozen notebooks and don't really want to save them all > manually; is there an easy way to get Mathematica to batch load > notebooks and save them as PDF? > > Thanks. > > -- > Erik Max Francis && m... at alcyone.com &&http://www.alcyone.com/max/ > San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis > What is now prov'd was once only imagin'd. > -- William Blake