# PDF Wizard (Workspaces)

<figure><img src="https://2707432902-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGZA5kgM4oTQMrpISbVT3%2Fuploads%2Fz3HwcC98pOCFBfAI56Gr%2F201.jpg?alt=media&#x26;token=11980bae-c4e3-4019-b70b-4858fcdbcea5" alt=""><figcaption><p>PDF Wizard</p></figcaption></figure>

In order to copy the **Generate PDF** UI Action for Workspace pages:

1. 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. In the **Workspace** tab, ensure the **Workspace Form Button** & **Format for Configurable Workspace** checkboxes are selected. Following the instructions in the **Workspace Client 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.
2. Visit the Workspace 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 **Workspace Client Script** similar to below:

```javascript
var modalOptions = {};
modalOptions.source_table = 'sys_user';

g_modal.showFrame({
    url: 'x_yala_pdf_pdf_generator.do?' + jsonToParams(modalOptions),
    title: 'Generate PDF',
    size: 'xl',
    height: 500,
    callback: function() {
        location.reload();
    }
});
```

To customize the behavior of the wizard, you can set any option below on the **modalOptions** object.

Customize the **Select Template** step:

* **modalOptions.select\_step\_display: \[boolean]:** Show/hide the first 'Select template' step. Otherwise, template must be pre-set *\[default: true]*
* **modalOptions.pdf\_template: \[sys\_id of template]**: Preset the selected template
* **modalOptions.pdf\_template\_read\_only: \[boolean]:** Display the 'Select template' step, but enable/disable it as read-only *\[default: false]*
* **modalOptions.pdf\_template\_display: \[boolean]:** Display the 'Select template' step, but show/hide the select box *\[default: true]*

Customize the **Merge Data** step:

* **modalOptions.merge\_step\_display: \[boolean]:** Show/hide the second 'Merge data into PDF' step. Otherwise, data source/record must be pre-set *\[default: true]*
* **modalOptions.source\_table: \[tableName]:** Set the source table for merge data
* **modalOptions.source\_table\_include\_extensions: \[boolean]:** Include extended tables from source table
* **modalOptions.source\_record\_table: \[tableName]:** Set the source table for merge data
* **modalOptions.source\_record\_id: \[sys\_id of record]:** Set the source record for merge data
* **modalOptions.merge\_read\_only: \[boolean]:** Enable/disable the 'Merge data into PDF' step as read-only *\[default: false]*
* **modalOptions.pdf\_data\_source: \[sys\_id of data source]:** Set data source for merge data. *(Note: Only applies to label printing)*

Customize the **Edit PDF** step:

{% hint style="info" %}
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.
{% endhint %}

* **modalOptions.enable\_edit:** \[boolean]: Enable editing the merged PDF document prior to save/download *\[default: false]*

Customize the **Save PDF** step:

* **modalOptions.save\_step\_display: \[boolean]:** Show/hide the third 'Save PDF' step *\[default: true]*
* **modalOptions.enable\_download: \[boolean]:** Enable the 'Download' option *\[default: true]*
* **modalOptions.enable\_save\_to\_current\_table: \[tableName]:** Enable the 'Attach to current' option. *\[default: false]*
* **modalOptions.enable\_save\_to\_current\_id: \[sys\_id of record]:** Enable the 'Attach to current' option. *\[default: false]*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yansalabs.com/pdf-generator/technical-docs/the-generate-pdf-wizard/pdf-wizard-workspaces.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
