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.

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]
share|improve this question
    
Why not CDFDeploy["G:\\tmp\\test.cdf", manip, Method -> "Standalone"] –  Rolf Mertig Jan 21 '13 at 23:06
    
@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. –  Szabolcs Jan 21 '13 at 23:08
    
@Rolf If you post that as an answer, I'll adapt the question to it. Or do you think I should just delete it? –  Szabolcs Jan 21 '13 at 23:09
    
The documentation is sufficiently strange that one does not immediately find CDFDeploy. So let's just keep it maybe. –  Rolf Mertig Jan 21 '13 at 23:11

1 Answer 1

up vote 9 down vote accepted
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.

share|improve this answer
    
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). –  Rolf Mertig Mar 31 at 20:40

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.