Skip to content

Instantly share code, notes, and snippets.

@andreabedini
Created June 20, 2014 08:25
Show Gist options
  • Save andreabedini/acc3c9c18eb148533273 to your computer and use it in GitHub Desktop.
Save andreabedini/acc3c9c18eb148533273 to your computer and use it in GitHub Desktop.
Mathematica snippet to mass-export to pdf all notebooks in a directory.
myPrintNotebook[filename_String] := Block[{nbo, pdfnamne},
nbo = NotebookOpen[ToFileName[Directory[], filename],
Visible -> False];
FrontEndExecute[FrontEndToken[nbo, "SelectAll"]];
FrontEndTokenExecute[nbo, "SelectionOpenAllGroups"];
pdfname = StringReplace[filename, ".nb" -> "_nb.pdf"];
Export[pdfname, nbo, "PDF"];
Print["saving to ", pdfname];
NotebookClose[nbo];
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment