This demo shows how to generate a PDF document. Firstly the document library DEC009X is libraried in. A phantom element is used in the schema declaration to display a link. This will run “action-generate-pdf”. This action removes the previous DOCUMENT_TEMPLATE schema and initializes it (using fm:assign init Target) with dummy report data: TEMPLATE_NAME, TITLE, and CONTENT.
Before the utility action action-DEC009XpreviewDocTemplate (which will generate and popup the pdf document) can be called, the developer must first tell FOX where the relevant data is so that the mail merged fields defined in the document template can be populated. To do this, the developer has to set a context called docdata1, which in effect is just a pointer to a particular element in the DOM, with a label of docdata. The utility action will then know exactly where to look for the mail merge data by using that context name.