# PDF Generator

> Generate and customize a PDF file dynamically from your app using the PDF Generator component.

https://docs.pandasuite.com/essentials/components/pdf-generator/

**The PDF Generator component allows you to dynamically generate a PDF file from your application. Whether from a blank document or an existing PDF file (interactive or not), you can customize and enrich your PDF on the fly: add text, images, shapes, or even dynamic fields filled in by the user.**

[Video: A customer feedback form is filled in and validated in the app, then the generated PDF is saved and opened with the answers]

## Use Cases

Here are a few concrete examples of how to use the PDF Generator:

- **Training application**: create a personalized certificate at the end of an e-learning course.
- **Interactive catalog**: allow the user to download a customized product sheet with the items they viewed.
- **Configurator or quote tool**: generate a PDF summary based on user selections.
- **Guided tour or audio guide**: create a take-away visit log in PDF format at the end of the experience.
- **Field application**: fill in an intervention report or visit summary generated as a PDF.

## Setting up the Component

### Inserting into the project

1. Open your project in **PandaSuite Studio**.
2. In the **Components** tab, search for **PDF Generator**.
3. Drag and drop the component into your screen or at the **Project** level if you want to access it from multiple screens.

> **Info**
>
> The **PDF Generator** is a non-visual component: you can configure it visually
> from PandaSuite Studio, but it will not appear in your app's interface. To
> display a PDF, use the [Web component](https://docs.pandasuite.com/essentials/multimedia/pdf/)

### Choosing the document

Once the component is added, you can configure it from the **Properties** panel:

- **New document (Yes/No)**: choose whether to start from a blank document or import an existing PDF file.

  [Image: PDF Generator properties: New document set to Yes, with the Width and Height of the blank document's page]

### Option 1: Blank document

- **Width / Height**: set the page format (A4, portrait/landscape, etc.) for a blank document.

The document starts empty, and you dynamically add content (text, images, shapes, etc.).

### Option 2: From an existing PDF

The file can contain a visual template on which you overlay dynamic fields.

- Import the document
- Specify the **File name**, e.g. Customer Feedback Form.pdf

Click the component to display it.

### Adding dynamic content

To insert dynamic content (text, image, etc.) into your PDF, you need to create [markers](https://docs.pandasuite.com/essentials/interactions/markers/).

#### Creating markers

1. Click on the **PDF Generator** component in the Object list.
2. In edit mode, draw a zone on the PDF using the mouse.
3. A marker is automatically created.

#### Customizing markers

- In the marker properties, add a [data binding](https://docs.pandasuite.com/essentials/data/data-binding/) on the **Content** field to link a dynamic variable (user name, date, result, etc.).

> **Info**
>
> Tip: The data used in markers can come from [Text
> Input](https://docs.pandasuite.com/essentials/components/text-input/), [Text
> Editor](https://docs.pandasuite.com/essentials/components/text-editor/), media components
> ([Camera](https://docs.pandasuite.com/essentials/components/camera/)...), or system variables.

[Image: PDF Generator in edit mode: the Name marker drawn on the form, its Content field bound to an input value in the properties]

## Component Features

### Trigger Events

- **PDF generated**: triggered when the PDF is ready and can be used to launch a download or send action.

### Interactive Actions

- **Generate PDF**
- **Download PDF**

## Best Practices & Tips

- Regularly preview: test positions and layout in preview mode to ensure proper placement.
- Add a waiting action or loading message while the PDF is being generated if it might take a while.
- Work with [variables](https://docs.pandasuite.com/essentials/data/variables/): centralize your data for easy insertion into multiple markers.
- Positioning is done manually: no grid or snap-to alignment available yet.

## Additional Resources

[Template: Customer Survey with PDF Generator](https://pandasuite.com/dashboard/use-template/ctyF1pUBaHn0WhDCT3OR)
