Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

This could be a basic code for this:

(* SetDirectory[] ??? Here you could set a directory to write the files... *)
Do[
    name=Check[NotebookFileName[nb], "NotSaved.nb", NotebookFileName::nosv];
    (* Set the stylesheet that fit your needs *)
    iniStyle = StyleDefinitions /. Options[nb];
    SetOptions[nb,StyleDefinitions->"Default.nb"];
    Export[FileBaseName[name],nb,"PDF"];
    SetOptions[nb,StyleDefinitions->iniStyle];
,{nb,Notebooks[]}
]
share|improve this answer
    
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. –  nullUser Dec 4 '13 at 17:42
    
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. –  SMiranda Dec 4 '13 at 18:16
add comment

If you evaluate this:

SetOptions[EvaluationNotebook[], 
 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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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