# HTML to PDF Merge Templates

For single-page and multi-page PDFs, it all starts at the **HTML to PDF Merge Templates** module in your left nav. This is where the top-level configuration interface exists for your PDF.

When you install Yansa PDF Generator, you will find an included **HTML to PDF Merge Template** named 'SAMPLE: Employee Offer Letter'. This is a great place to get started.

{% hint style="info" %}
You can always use the **Generate PDF** button in the form header to test creation of a PDF from your template. This is great for iterating during your design & creation process.
{% endhint %}

<figure><img src="/files/ZRgHmCjsP0cDpIsKTHbi" alt=""><figcaption><p>HTML to PDF Merge Template</p></figcaption></figure>

* **Source table**: The table to be used as the primary data source for dynamic data included in your PDF.
* **State**: Only 'Published' templates will be visible in the PDF generation modal that is typically used by your users when they generate a PDF document.
* **Use advanced styling**: Enable/disable the 'Advanced Styling' tab for enhanced CSS customization.

The **HTML to PDF Merge Template** form is organized into tabs to simplify configuration:

* **Content**: The HTML content to be converted to PDF
* **Page Configuration**: PDF page configuration details
* **Advanced Styling**: Advanced CSS styling

<div><figure><img src="/files/I3jE4AUUSUwbhHITFLPt" alt=""><figcaption><p>Content</p></figcaption></figure> <figure><img src="/files/LcC6jvmIl5RiJqQ2PYAS" alt=""><figcaption><p>Page Configuration</p></figcaption></figure> <figure><img src="/files/168umEC9xpW0gvDgvpb0" alt=""><figcaption><p>Advanced Styling</p></figcaption></figure></div>

### Content

* **HTML template**: A custom HTML editor where you can design the content of the PDF to be created.

{% hint style="info" %}

### Content for the HTML Template

The **HTML template** field can include static, dynamic, and programmatic content. To include dynamic or programmatic content, you will reference an associated [PDF Template Merge Map](/pdf-generator/technical-docs/building-a-pdf-template/merge-maps.md) record. When doing so, simply use ${handlebar} brackets around the 'Merge key' value for the desired Merge Map.

For example, if you have a Merge Map record with a 'Merge key' of 'FIRST\_NAME', you can include that dynamic value in your **HTML template** with *${FIRST\_NAME}*.
{% endhint %}

### Page Configuration

* **Page size**: Desired PDF page size
* **Margins**: Desired margins for top/bottom/left/right on the PDF
* **Header & Footer Configuration (Type)**:
  * **Simple**: In most cases, a 'Simple' header/footer is recommended. This provides options for including page numbers and a header/footer image.
  * **Advanced**: 'Advanced' headers/footers allow you to customize the HTML and Style tags for the header/footer. *(Note: This requires advanced HTML knowledge)*

{% hint style="info" %}
You can also use [Merge Keys](/pdf-generator/technical-docs/building-a-pdf-template/merge-maps.md) within your document header & footer. Simply select a 'Type' of 'Advanced', and then write the necessary HTML, including Merge Keys in handlebar brackets like ${FIRST\_NAME}
{% endhint %}

### Advanced Styling

* **CSS**: Custom CSS to apply to the entire PDF template *(Note: This requires advanced CSS knowledge)*


---

# 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/building-a-pdf-template/html-to-pdf-merge-templates.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.
