Is there a simple way to export all open notebooks to pdfs? Also, when I export notebooks the font looks too big / the margins are too big. Can I change these settings when exporting?


2 Answers 2


This could be a basic code for this:

(* SetDirectory[] ??? Here you could set a directory to write the files... *)
    name=Check[NotebookFileName[nb], "NotSaved.nb", NotebookFileName::nosv];
    (* Set the stylesheet that fit your needs *)
    iniStyle = StyleDefinitions /. Options[nb];
  • $\begingroup$ How do I change the font size? And this looks like it will change my working notebook styles. I don't want to change those. I just want the font size smaller in the exported pdf, but not in the actual notebook while I am working in mathematica. $\endgroup$
    – nullUser
    Dec 4, 2013 at 17:42
  • $\begingroup$ I edited the code so that leaves the initial stylesheet. I don't know the exact style that you want to modify. The easy way could be edit the actual stylesheet a save as new one (you should change "Default.nb" for this) a edit the "printout" style that you need. $\endgroup$
    – crazzymath
    Dec 4, 2013 at 18:16

If you evaluate this:

 StyleDefinitions -> 
  Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], 
    Cell[StyleData[All, "Printout"], Magnification -> 1, 
     FontSize -> 12]}, 
   StyleDefinitions -> "PrivateStylesheetFormatting.nb"]]

You can adjust magnification and font size accordingly (and include cell margins if needed). For this to work you need to have your printing environment set to "Printout". The fact that your fonts are too big makes me think your printing environment is set to another mode. Ideally your would adjust this in your stylesheet.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.