8
$\begingroup$

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]

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

NotebookClose[doc]
$\endgroup$
4
  • $\begingroup$ Why not CDFDeploy["G:\\tmp\\test.cdf", manip, Method -> "Standalone"] $\endgroup$ Jan 21, 2013 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, 2013 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, 2013 at 23:09
  • $\begingroup$ The documentation is sufficiently strange that one does not immediately find CDFDeploy. So let's just keep it maybe. $\endgroup$ Jan 21, 2013 at 23:11

1 Answer 1

11
$\begingroup$
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.

$\endgroup$
1
  • $\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$ Mar 31, 2014 at 20:40

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.