Thanks.
--
Erik Max Francis && m...@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
--David
On Nov 21, 3:36 am, Erik Max Francis <m...@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...@alcyone.com &&http://www.alcyone.com/max/
> 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?
There is FileNames[], StringReplace[], NotebookOpen[], Export[] &
SetDirectory[] ....
In a fresh notebook, have you tried something like
SetDirectory["directory where my notebooks live"];
ifile = FileNames["*.nb"];
ofile = StringReplace[#, {"nb"->"PDF"}]& /@ ifile;
(
inb = NotebookOpen[ifile[[#]]];
Export[ofile[[#]], inb]
)& /@ Range@Length@ifile;
YMMV depending on exactly what you want to do before saving the notebooks.
Regards,
Dave.
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...@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...@alcyone.com &&http://www.alcyone.com/max/
Thanks to both Davids for their replies :-).
--
Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis
Nine worlds I remember.
-- Icelandic Edda of Snorri Sturluson