11.07.2015 Views

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

webMathematica™ Wolfram - Wolfram Research

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

124 webMathematica User GuideCreating PDF ExampleThis section describes an example that generates a notebook and converts it to PDF. For it towork you need to install PDF tools described in the last section. If you installed webMathematicaas described above, you should be able to connect to this JSP via http://localhost:8080/webMathematica/Examples/PDF/Generate.jsp. (You may have some other URL for accessingyour server.) The source is in webMathematica/Examples/PDF/Generate.jsp. Here is the JSPsource.Needs["ExampleUtilities`Content`"]If[MSPValueQ[$$button],nb = MakeNotebook["PDF"];pdf = UseFrontEnd[ExportString[nb, "PDF"]]]This code loads a basic package for creating notebooks. This is done in a separate evaluatetag, as described in the section Mathematica Packages and Applications. It calls the functionMakeNotebook, which generates a very simple notebook and converts this into a string of PDF.The string is returned to the client using MSPReturn.Returning General ContentThe typical result of a webMathematica request is an HTML page, which might include referencesto images. The commands available for webMathematica are designed to make this typeof request very convenient. However, it is also very useful to be able to return other formatssuch as Mathematica notebooks or TeX documents. Mathematica commands for generatingthese other formats are Export and ExportString. When these other formats are returned to abrowser, it can often launch a helper application that provides special functionality for thatformat. This section discusses how to use webMathematica to return general content of differentformats.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!