# ekoopmans/html2pdf.js

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/ekoopmans-html2pdf-js).**

4,880 stars · 1,468 forks · JavaScript · MIT

## Links

- GitHub: https://github.com/eKoopmans/html2pdf.js
- awesome-repositories: https://awesome-repositories.com/repository/ekoopmans-html2pdf-js.md

## Topics

`canvas` `client-side` `html` `javascript` `pdf-generation`

## Description

html2pdf.js is a client-side JavaScript library used to convert HTML elements and webpages into downloadable PDF documents. It operates entirely within the browser, removing the need for a backend server to generate files.

The library employs a conversion pipeline that renders HTML to a canvas before generating the final PDF layout. This process includes the ability to preserve active hyperlinks by overlaying clickable regions on anchor tags and managing page breaks through specific style rules or selectors.

Users can configure document appearance through settings for page margins, filenames, and image quality. The conversion process is managed via a promise-based workflow, allowing for sequential processing steps and the insertion of custom functions to modify the data flow.

## Tags

### Content Management & Publishing

- [Client-Side PDF Generators](https://awesome-repositories.com/f/content-management-publishing/content-processing-transformation/document-processing-conversion/document-processing-tools/pdf-manipulation-utilities/pdf-editors/pdf-content-converters/client-side-pdf-generators.md) — Provides the core capability to generate PDF documents entirely within the browser from HTML or canvas content.
- [Web-to-PDF Converters](https://awesome-repositories.com/f/content-management-publishing/content-processing-transformation/document-processing-conversion/document-processing-tools/format-conversion-toolkits/pdf-format-converters/web-to-pdf-converters.md) — Renders web pages and HTML content into static PDF documents using a browser-based approach.
- [HTML to PDF Converters](https://awesome-repositories.com/f/content-management-publishing/html-to-pdf-converters.md) — Transforms web-based HTML and CSS layouts into portable PDF files directly in the browser. ([source](https://github.com/ekoopmans/html2pdf.js#readme))
- [Web Content Export Tools](https://awesome-repositories.com/f/content-management-publishing/web-content-export-tools.md) — Converts specific HTML elements or full webpages into portable PDF files for users to download.
- [PDF Hyperlink Overlays](https://awesome-repositories.com/f/content-management-publishing/external-hyperlinks/pdf-hyperlink-overlays.md) — Preserves active hyperlinks by calculating anchor coordinates and overlaying clickable regions on the final PDF.
- [Page Break Management](https://awesome-repositories.com/f/content-management-publishing/page-break-management.md) — Allows the injection of manual page breaks using CSS style rules to prevent content splitting across pages.
- [Visual Layout Controls](https://awesome-repositories.com/f/content-management-publishing/pdf-document-generation/visual-layout-controls.md) — Allows adjusting page margins and image quality to define the visual appearance of generated documents. ([source](https://github.com/ekoopmans/html2pdf.js#readme))

### Development Tools & Productivity

- [Client-Side Conversion Engines](https://awesome-repositories.com/f/development-tools-productivity/client-side-conversion-engines.md) — Executes the entire HTML-to-PDF conversion pipeline in the browser using JavaScript without server round-trips.

### Graphics & Multimedia

- [HTML-to-PDF Canvas Renderers](https://awesome-repositories.com/f/graphics-multimedia/canvas-rendering/html-to-pdf-canvas-renderers.md) — Implements a conversion pipeline that renders HTML to canvas before generating the final PDF layout.

### Web Development

- [Canvas Rasterizers](https://awesome-repositories.com/f/web-development/canvas-rasterizers.md) — Converts HTML elements into pixel-based canvas images as an intermediate step before PDF generation.
- [DOM-to-Canvas Renderers](https://awesome-repositories.com/f/web-development/dom-to-canvas-renderers.md) — Translates the current DOM tree and styles into a canvas-based pixel representation for consistent rendering.
