0
$\begingroup$

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.

$\endgroup$
2
$\begingroup$

Pretty simple:

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

SetOptions[nb, {ScreenStyleEnvironment -> "Printout", Magnification -> 1.5}]
| improve this answer | |
$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – Edmund Sep 25 '15 at 12:23
  • $\begingroup$ 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. $\endgroup$ – Sjoerd C. de Vries Sep 25 '15 at 13:33
  • $\begingroup$ @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%. $\endgroup$ – Karsten 7. Oct 24 '15 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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