Message Boards Message Boards

0
|
10723 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Embedding Custom Stylesheet in CDF for distribution?

Posted 9 years ago

I have been learning how to create and use custom stylesheets. I really like the functionality. However, when I go to share them via CDF...those CDF's don't load the custom stylesheet. They see the info using the default stylesheet. Is there a way to embed the custom stylesheet in the CDF for distribution so that the reader sees what I see? Thank you.

POSTED BY: Michael McCain
3 Replies

I finally realized, or discovered, that installation of the Wolfram Free CDF Player does create an entry in the user's data files such that one can install non-Wolfram applications. In Windows it's in:

username/AppData/Roaming/WolframCDFPlayer/Applications

If you include an Applications/applicationName/FrontEnd/StyleSheets/style sheet, then the CDF files can use it.

However, the bad news is that, in my example at least, the package code doesn't work. It may be that DynamicModules aren't supported.

My example had a custom style sheet, DynamicModules with movable (and sometimes constrained) locators that carried lines with them, dynamic textual displays. It also had a separate CDF document window that could be launched with a button from the primary CDF document. The separate window had sliders and rotatable 3D graphics. The only thing that worked was picking up the style sheet and the movable locators.

However, again with the example I used, if I place the extra application into the Wolfram CDF Player program files, then everything works perfectly!

So it's another case where a miss is as good as a mile. Perhaps there is something simple I'm missing, or perhaps there is a reason.

Thank you! I tried it again and it seems to work now. It looks like the CDF export works. I must have been a glitch or something I did wrong.

POSTED BY: Michael McCain

Work with the Mathematica notebook that produces the CDF file by CDF Export. There are two ways.

1) Use the Mathematica Menu item Format/Edit Style Sheet on the notebook that creates the CDF file. You can then add changes to the styles. You have to do this for each CDF file. Then do the CDF Export.

2) However, if you're going to make many CDF files then you could make an application that defined a style sheet, and package routines also, and add it to the Wolfram CDF Player ... AddOns/Application folder (as well as your regular Mathematica $UserBaseDirectory/Applications folder.) WRI has placed many of their own applications there and I don't see any reason why your can't put yours. This is a bit tricky though because the reader has to add it to his copy of the CDF Player. On Windows, at least, one has to copy the application in (not unzip) and it requires Administrator permission. I've tested this with the free CDF Player, and changing the names of the applications in my regular Mathematica to disable them, and it appears to work. This has the great advantage that you could have many CDF files, say for a course, and they could all use the single copy of the style sheet and common package code.

I've suggested to WRI that they add a UserBaseDirectory for the CDF Player (completely different from the corresponding UserBaseDirectory for Mathematica) and the CDF Player look there for packages and style sheets (as well as in the Wolfram folders.) Then users could just unzip a CDF Application there and start reading the documents.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract