PDF Generator
HomeBlogDocsContact
  • Overview
    • Try It!
    • Introduction
    • Key Features
    • Industry Use Cases
      • PDF Generator for Human Resources
    • Videos
  • Technical Docs
    • Getting Started
    • Building a PDF Template
      • HTML to PDF Merge Templates
      • Printable Labels
        • Label Templates
        • Label Configuration
        • Adding New Avery Type Label Configuration
        • Printing Labels
      • Merge Keys
      • Data Sources
    • Generating a PDF Document
      • Create from Wizard
      • Create from Flow Action
      • Create from Script
    • The Generate PDF Wizard
      • PDF Wizard (Standard Forms)
      • PDF Wizard (Workspaces)
      • PDF Wizard (List View)
    • Adding QR / Barcodes to PDFs
      • How-to Create Barcode Labels
    • TinyMCE Configs
    • Logging
    • Troubleshooting
Powered by GitBook
On this page
  1. Technical Docs
  2. The Generate PDF Wizard

PDF Wizard (Standard Forms)

PreviousThe Generate PDF WizardNextPDF Wizard (Workspaces)

Last updated 1 day ago

In order to copy the Generate PDF UI Action for standard forms:

  1. Copy the wizard formatter

    1. Visit System UI -> Formatters in the left nav. Open the formatter titled 'PDF Generator'.

    2. Change the Table to match the table where you wish to place the button that will open the wizard. Insert-and-Stay a new copy of the formatter.

    3. Visit the table where you placed the formatter.

    4. Right-click the form header and select Configure -> Form Layout. Add the 'PDF Generator' formatter to the form (it is not visible, so you can add it anywhere you like)

  2. Copy the wizard button

    1. Visit Yansa PDF Generator -> General Settings in the left nav.

    2. Right-click the form header and select Configure -> UI Actions.

    3. Select & open the UI Action titled 'Generate PDF (Sample).

    4. Update the Name and Table fields to match the table where you wish to place the button that will open the wizard. Following the instructions in the Script field, update code values to accommodate your needs (see below for details on available customizations). Insert and Stay to create a new copy of the UI Action.

  3. Visit the standard form view for a record on the specified table. Click the button to open the Generate PDF wizard.

Customization Options

By default, the Generate PDF UI Action will have a Script similar to below:

function renderModal() {
    var pdfModal = new YansaPDFUI();
    pdfModal.setSourceTable('sys_user');
    pdfModal.render();
}

There are a number of methods on the YansaPDFUI object (in this example, 'pdfModal') that you may use to customize the behavior of the wizard.

Customize the Select Template step:

  • pdfModal.setSelectStepDisplay(flag: boolean): Show/hide the first 'Select template' step. Otherwise, template must be pre-set [default: true]

  • pdfModal.setPDFTemplate(sysId: string): Preset the selected template

  • pdfModal.setPDFTemplateReadOnly(flag: boolean): Display the 'Select template' step, but enable/disable it as read-only [default: false]

  • pdfModal.setPDFTemplateDisplay(flag: boolean): Display the 'Select template' step, but show/hide the select box [default: true]

Customize the Merge Data step:

  • pdfModal.setMergeStepDisplay(flag: boolean): Show/hide the second 'Merge data into PDF' step. Otherwise, data source/record must be pre-set [default: true]

  • pdfModal.setSourceTable(tableName: string, includeExtensions: boolean): Set the source table for merge data

  • pdfModal.setSourceRecord(tableName: string, sysId: string): Set the source table & record for merge data

  • pdfModal.setMergeReadOnly(flag: boolean): Enable/disable the 'Merge data into PDF' step as read-only [default: false]

  • pdfModal.setPDFDataSource(sysId: string): Set data source for merge data. (Note: Only applies to label printing)

Customize the Edit PDF step:

An optional 'Edit' step can be enabled wherein the content of the merged PDF document can be changed prior to the save/download step. This can be useful for situations where customization of the merged template is needed prior to finalization.

  • pdfModal.enableEdit(): Enable editing the merged PDF document prior to save/download [default: false]

Customize the Save PDF step:

  • pdfModal.setSaveStepDisplay(flag: boolean): Show/hide the third 'Save PDF' step [default: true]

  • pdfModal.disableDownload(): Disable the 'Download' option [default: false]

  • pdfModal.enableSaveToCurrent(tableName?: string, sysId?: string): Enable the 'Attach to current' option. If you provide a table/sysId, it will save to that target record. Otherwise, it saves to current record [default: false]

To reload form on-close of the wizard (to display new attachments, for example), include the following at the bottom of your UI Action script:

PDF Wizard (w/o Edit Step)
PDF Wizard (w/ Edit Step)