> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chromiumly.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# HTML conversion and screenshots

> Convert an HTML file to PDF or capture a screenshot with HtmlConverter and HtmlScreenshot.

The Chromium HTML route expects the main HTML file to be named **`index.html`**. You can send additional assets (CSS, images, fonts) via the `assets` option or by passing multiple files; reference them in your HTML by **filename only** — do not use absolute paths (`/img.png`) or subdirectories (`./assets/img.png`), because Gotenberg stores all uploaded files in a single temporary directory.

## Convert HTML to PDF

```typescript theme={null}
import { HtmlConverter } from "chromiumly";

const htmlConverter = new HtmlConverter();
const buffer = await htmlConverter.convert({
  html: "path/to/index.html",
});
```

You can pass a file path string, a `Buffer`, or a `ReadStream`. Optional [conversion options](/chromium/options) (e.g. `properties`, `header`, `footer`) go in the same options object.

## Capture HTML as screenshot

```typescript theme={null}
import { HtmlScreenshot } from "chromiumly";

const screenshot = new HtmlScreenshot();
const buffer = await screenshot.capture({
  html: "path/to/index.html",
});
```

Use `properties` to set image format, quality, and dimensions. See [Options](/chromium/options).
