0

GenerateDocument does not have any options for settings on the notebook it creates. How do I generate a document with

ScreenStyleEnvironment -> "Printout", Magnification -> 1.5

without clicking these options on the template notebook at design time. That is, I could select these options when editing the template but I would prefer not to have to remember to set them every time I finish working on a template (and deselecting them every time I start working on a template).

The template file is not open when GenerateDocument is called. I am passing the full filename string of the template notebook to GenerateDocument along with the association of parameters as the second argument.

Edmund
  • 42,267
  • 3
  • 51
  • 143

1 Answers1

2

Pretty simple:

nb = GenerateDocument["ExampleData/BasicTemplate.nb", <|"author" -> "Henry Jones"|>];

SetOptions[nb, {ScreenStyleEnvironment -> "Printout", Magnification -> 1.5}]
Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323
  • Are you getting any odd zooming issues from this? When I do this the zoom is much bigger that 1.5 on the screen even though the zoom selector in the lower right says 150%. I have to select another zoom level and then reselect 150% to get it to the correct magnification. I have high DPI scaling disabled to stop the blurring. Do you see this as well? – Edmund Sep 25 '15 at 12:23
  • I haven't measured the resulting zoom (but it was clearly zoomed; I also used a zoom of 3 which was bigger still), but I recall that in my case the zoom selector was still on 100%, so it didn't seem to have been updated. – Sjoerd C. de Vries Sep 25 '15 at 13:33
  • @Edmund The Magnification set by this method is the same as using the menu Window►Magnification. In some situations this is different to setting the magnification in the lower right corner. Make sure that the magnification in the notebook you use to execute this code has a magnification of 100%. – Karsten7 Oct 24 '15 at 22:42