# @types/html-to-pdfmake

> TypeScript definitions for html-to-pdfmake

Latest version **2.4.5** (published 2026-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/html-to-pdfmake
pnpm add @types/html-to-pdfmake
yarn add @types/html-to-pdfmake
bun add @types/html-to-pdfmake
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.4.5 |
| Published | 2026-01-28 |
| First published | 2021-04-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51445 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/html-to-pdfmake
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-to-pdfmake
- npm.io page: https://npm.io/package/@types/html-to-pdfmake

## Dependencies (2)

- [@types/jsdom](https://npm.io/package/@types/jsdom.md) *
- [@types/pdfmake](https://npm.io/package/@types/pdfmake.md) ^0.2.0

## Recent versions

- 2.4.5 (latest) — 2026-01-28
- 2.4.4 (ts5.1) — 2023-11-07
- 2.1.0 (ts3.8) — 2021-04-26
- 2.4.3 — 2023-10-18
- 2.4.2 — 2023-09-16
- 2.4.1 — 2023-05-06
- 2.4.0 — 2023-01-28
- 2.1.1 — 2022-07-23

## README

# Installation
> `npm install --save @types/html-to-pdfmake`

# Summary
This package contains type definitions for html-to-pdfmake (https://github.com/Aymkdn/html-to-pdfmake#readme).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-to-pdfmake.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-to-pdfmake/index.d.ts)
````ts
/**
 * This module will convert some basic and valid HTML code to its equivalent in pdfmake.
 * @see https://www.npmjs.com/package/html-to-pdfmake
 */
declare function htmlToPdfmake(
    html: string,
    options?: Partial<{
        /**
         * If you use Node, then you'll have to pass the window object
         */
        window: import("jsdom").DOMWindow;
        /**
         * You can overwrite the default styles using defaultStyles.
         * Please, note that the above default styles are stronger than the ones defined in the style classes.
         */
        defaultStyles: import("pdfmake/interfaces").StyleDictionary;
        /**
         * In some cases, you may see some extra blank spaces in the PDF. Because removing them could be quite resource consuming, the option is false by default.
         */
        removeExtraBlanks: boolean;
        /**
         * By default the display:none elements won't be parsed. Set this option to true to display the hidden elements in the PDF.
         */
        showhidden: boolean;
        /**
         * You can define a list of style properties that should not be parsed.
         */
        ignoreStyles: string[];
        /**
         * If you're using html-to-pdfmake in a web browser with images, then you can set this option to true
         * and it will automatically load your images in your PDF using the {images} option of PDFMake.
         * Using this option will change the output of html-to-pdfmake that will return an object with {content, images}
         */
        imagesByReference: boolean;
        /**
         * You can overwrite the default sizes for the old HTML4 tag <font> by using fontSizes. It must be an array with 7 values
         */
        fontSizes: [number, number, number, number, number, number, number];
        /**
         * By passing replaceText as a function with two parameters (text and nodes) you can modify the text of all the nodes in your HTML document.
         */
        replaceText: (text: string, nodes: HTMLElement[]) => string;
        /**
         * By passing tableAutoSize with true, then the program will try to define widths and heights for the tables, based on CSS properties width and height that have been provided to TH or TD.
         */
        tableAutoSize: boolean;
    }>,
): import("pdfmake/interfaces").Content;

export = htmlToPdfmake;

````

### Additional Details
 * Last updated: Wed, 28 Jan 2026 19:06:34 GMT
 * Dependencies: [@types/jsdom](https://npmjs.com/package/@types/jsdom), [@types/pdfmake](https://npmjs.com/package/@types/pdfmake)

# Credits
These definitions were written by [Martin Zloch](https://github.com/me), and [Cecil Wöbker](https://github.com/cwoebker).

---
_Source: https://npm.io/package/@types/html-to-pdfmake · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
