# 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="https://2707432902-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGZA5kgM4oTQMrpISbVT3%2Fuploads%2F9bcaw2pRpMWnWEsbkL0f%2F085.jpg?alt=media&#x26;token=ad3b9367-39e1-420b-8421-61f0f07492dd" 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="https://2707432902-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGZA5kgM4oTQMrpISbVT3%2Fuploads%2F0Z7RDzWRK7RRzjkXKDPl%2F086.jpg?alt=media&#x26;token=d091f719-7845-47ac-9baf-82a5f48cb34f" alt=""><figcaption><p>Content</p></figcaption></figure> <figure><img src="https://2707432902-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGZA5kgM4oTQMrpISbVT3%2Fuploads%2FkRgpr8CMuljuyysEXKy4%2F087.jpg?alt=media&#x26;token=12b2c900-8754-4593-8947-8476475465e7" alt=""><figcaption><p>Page Configuration</p></figcaption></figure> <figure><img src="https://2707432902-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGZA5kgM4oTQMrpISbVT3%2Fuploads%2Fz26t36WxJxPvza3VLPBS%2F088.jpg?alt=media&#x26;token=214a5cfe-ea03-4266-aeda-638bc0ea4222" 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](https://docs.yansalabs.com/pdf-generator/technical-docs/building-a-pdf-template/merge-maps) 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](https://docs.yansalabs.com/pdf-generator/technical-docs/building-a-pdf-template/merge-maps) 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)*
