How can I programmatically create a CDF which is similar to the CDFs created by File -> CDF Export -> Standalone...? Export supports CDFs but it does not use the same options as File -> Export... and it does not seem to allow setting the WindowSize which I also need.

My current solution is the following (ugly):

manip = Manipulate[Plot[k x, {x, 0, 10}], {k, 1, 5}, SaveDefinitions -> True]

  doc = CreateDocument[manip,
    ScrollingOptions -> {"VerticalScrollRange" -> Fit}, 
    ShowCellBracket -> False, 
    Deployed -> True, CellContext -> Notebook, 
    TrackCellChangeTimes -> False]];

  • $\begingroup$ Why not CDFDeploy["G:\\tmp\\test.cdf", manip, Method -> "Standalone"] $\endgroup$ – Rolf Mertig Jan 21 '13 at 23:06
  • $\begingroup$ @Rolf That is what I needed ... I never seriously worked with CDF before ... Actually this is not mentioned on the "How to create CDF" page, nor on the page describing the CDF export format. $\endgroup$ – Szabolcs Jan 21 '13 at 23:08
  • $\begingroup$ @Rolf If you post that as an answer, I'll adapt the question to it. Or do you think I should just delete it? $\endgroup$ – Szabolcs Jan 21 '13 at 23:09
  • $\begingroup$ The documentation is sufficiently strange that one does not immediately find CDFDeploy. So let's just keep it maybe. $\endgroup$ – Rolf Mertig Jan 21 '13 at 23:11
CDFDeploy["G:\\tmp\\test.cdf", manip, Method -> "Standalone"] 

does what is needed.

It also supports setting the WindowSize option.

Unfortunately this introduction to CDF does not mention CDFDeploy as a function. One has to arrive here to find this.

  • $\begingroup$ However, it looks like that for more control (say, you want to have WindowsMargins settings saved in thd CDF), the Epxort method is to be preferred over CDFDeploy (which seems to overwrite any explicit WindowMargins settings). $\endgroup$ – Rolf Mertig Mar 31 '14 at 20:40

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.