---
title: "HtmlToPdfPostExecutorV2"
slug: "html-to-pdf-post-executor-v-2"
updated: 2026-08-18T11:46:55Z
published: 2026-08-18T11:46:55Z
canonical: "docs.lobstersoftware.com/html-to-pdf-post-executor-v-2"
---
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.
# HtmlToPdfPostExecutorV2
| **Class name** | `com.ebd.hub.datawizard.postexec.HtmlToPdfPostExecutorV2` |
| --- | --- |
## Description
This post-executor converts HTML files to PDF files. It is configured via a properties file.
Two conversion engines are supported: **Aspose** (default) and **Flying Saucer**. The engine is controlled via the `engine` property.
## Configure profile
Use a profile without Mapping. Use a "File" Input agent to read the HTML file in Phase 1, and configure a "File" Response with this post-executor in Phase 6. For the response path content, select "as received".
## Engine comparison
| Criterion | Aspose (default) | Flying Saucer |
| --- | --- | --- |
| CSS support | Comprehensive, including many aspects of CSS3. | Only CSS 2.1 |
| JavaScript / `<script>` tags | Not supported | Not supported. |
| HTML source | Any HTML, including from external or poorly controlled sources. | Static, self-generated HTML with CSS 2.1-compliant styling. |
| Custom CSS (`custom.css`) | Not available | Available—applies the original styling. |
| License | Commercial | Open Source |
| Property activation | `engine=aspose` or omit the property | `engine=flying-saucer` |
**Aspose** is recommended when the HTML originates from external or hard-to-control sources, uses modern CSS, or when the effort required to achieve CSS 2.1 compliance is not justified.
**Flying Saucer** is recommended when the HTML is specifically generated for this conversion, is fully under your control, and can be designed to be CSS 2.1-compliant. This is especially true when `custom.css` is required to produce an exact, reproducible output.
## Flying Saucer (starting with Release 26.2)
This is enabled via `engine=flying-saucer`. It refers to the open-source project [Flying Saucer](https://github.com/flyingsaucerproject/flyingsaucer).
**NOTE:** An invalid value for `engine` (i.e., neither `aspose` nor `flying-saucer`) will result in an exception. The library applies all CSS styling from the original HTML code, unless it can't process it.
### Requirements and restrictions
- The HTML input document must consist entirely of static HTML. `<script>` tags are not executed and are ignored.
- Only **CSS 2.1** is supported. CSS3 features (e.g., Flexbox, Grid, many modern selectors) are not supported or are only partially supported.
- The HTML document must therefore include all necessary styles inline or via a `<style>` block that are compatible with CSS 2.1.
## Properties
| Property | Type | Requirement | Engine | Description |
| --- | --- | --- | --- | --- |
| `engine` | String | No | Both | Conversion engine. Valid values: `aspose`, `flying-saucer`. Default: `aspose` (even if the property is missing). Invalid values result in an exception. |
| `format` | String | Yes | Both | Size. Examples: `A4`, `A3`, `LETTER`. |
| `orientation` | String | Yes | Both | Page orientation. Valid values: `PORTRAIT`, `LANDSCAPE`. |
| `margin.top` | Float | No | Both | Top margin in mm. Default: `0`. |
| `margin.bottom` | Float | No | Both | Bottom margin in mm. Default: `0`. |
| `margin.left` | Float | No | Both | Left margin in mm. Default: `0`. |
| `margin.right` | Float | No | Both | Right margin in mm. Default: `0`. |
| `font.size` | Float | No | Aspose | Font size in points. Example: `12.0`. |
| `font.linespacing` | Float | No | Aspose | Line spacing as a factor. Example: `1.0` = single line spacing. |
| `font.style` | Integer | No | Aspose | Font style. `0` = normal, `1` = bold, `2` = italic, `3` = bold + italic. |
| `custom.css` | String | No | Flying Saucer | Path to a CSS file containing additional styles. This is applied after the original HTML styling and overrides it in case of conflicts. Must be CSS 2.1-compliant. |
> [!WARNING]
> **IMPORTANT:**
>
> The contents of the `custom.css` file are not checked or supported by Lobster. Make sure the file is CSS 2.1 compliant. Otherwise, unexpected display issues may occur.
## Examples
### Example 1: Aspose (default)
```undefined
format=A4
orientation=LANDSCAPE
margin.top=3
margin.bottom=3
margin.left=3
margin.right=0
font.linespacing=1.0
font.size=12.0
font.style=1
```
### Example 2: Flying Saucer with custom CSS
```undefined
engine=flying-saucer
format=A4
orientation=PORTRAIT
margin.top=10
margin.bottom=10
margin.left=15
margin.right=15
custom.css=/path/to/custom-overrides.css
```
The core task of Phase 3. Mapping transfers data from the source structure to the target structure according to defined rules. In the process, fields can be transformed, functions can be called, and values can be calculated.
The input agent receives data in Phase 1 and starts a job for further processing. It works either as event based (passively waits for data) or scheduled (actively fetches data).
Input: An input agent receives the data. It can work either as event based (e.g. FTP upload) or scheduled (cron).
The response determines how a profile sends processed data. In Phase 6, a response determines how and where the output data is sent or stored, e.g., via FTP, HTTP or e-mail. A profile can use several responses in parallel.
Responses: The profile stores the source data or sends it, for example, via FTP, HTTP, or e-mail.