I want to print Manipulate[] graphics while batch printing several notebooks. Here's the long version:
I have several Manipulate[] graphics cells in my notebooks. The only way I know of to get the graphics to appear in PDF output is to open the notebook, evaluate it, and then save to PDF. If I close my notebook after evaluating the cells with Manipulate[] graphics in them, when I reopen the notebook the graphics are gone.
Now I want to process an entire directory of ~20 notebooks with one command. I thought that by opening the notebooks with NotebookOpen[] then evaluating them with NotebookEvaluate[] before running NotebookPrint[notebook,"filename.pdf"] that would get the Manipulate[] graphics to print to PDF.
Unfortunately, that didn't work. I get huge gray boxes with manipulator controls instead of the graphics images.
This is the code I'm using:
allToPDF[] := Module[{inDir, outDir, nbFileNames, toPDF}
, inDir = SetDirectory@NotebookDirectory[];
outDir = inDir <> "PDF";
nbFileNames = FileNames["review*.nb"];
toPDF[nbFileName_] := Module[{outFileName, inFileName, nb}
, inFileName = NotebookDirectory[] <> "\\" nbFileName;
outFileName =
inDir "\\PDF\\" <> FileBaseName[nbFileName] <> ".pdf";
If[FileExistsQ[
outFileName] \[And] (FileDate[inFileName] <
FileDate[outFileName]), Return[]];
nb = NotebookOpen[inFileName];
NotebookEvaluate[nb];
NotebookPrint[nb, outFileName];
NotebookClose[nb]
];
toPDF[#] & /@ nbFileNames
]
allToPDF[]