hub.eb?material_id=15

Generate PDF


This sample demonstates how to generate a PDF document from an online form and covers:

  1. How to include headers and footers within a PDF page
  2. How to specify which pages to include within the PDF document
  3. Pop up the generated PDF in a separate window
  4. Save a hard copy to the file system.

On pages HEALTH_1 and HEALTH_2: the page controls (root control on the outline view) contain PDF header and footer values and styles. These are output to the PDF document header and footer areas of the document.

The Script functions contains the function outputPDF(display) that configures and generates the PDF document. This function takes a boolean display value, if set to true the PDF is displayed in a popup window, if set to false the PDF is saved to the file system.

Various configuration options can be set before generating the PDF:

var output = new PdfOptions();
output.pages = [pages.HEALTH_1, pages.HEALTH_2]; // Pages to print
output.reportMode = true; // Print in report mode
output.display = display; // Display PDF in popup
output.save = true; // Save PDF to file system
form.generatePdf(output); // Generate the PDF

The Script functions also contains the function hidePDFControls() to hide the navigation buttons, demonstrating how we can dynamically change the pages before they are displayed as a PDF. 

Related