A fork of html2pdf.js with modern build tooling and improved HTML rendering.
This fork makes the following improvements to the original html2pdf.js:
- Replaces
html2canvaswithhtml2canvas-profor improved HTML rendering - Uses modern build tooling to provide ESM, CommonJS, and UMD builds
- Simplified package structure for easier use in modern JavaScript environments
# Using npm
npm install @koukitsuko/html2pdf.js
# Using pnpm
pnpm add @koukitsuko/html2pdf.jsimport html2pdf from '@koukitsuko/html2pdf.js';
// Generate PDF from element
const element = document.getElementById('element-to-print');
html2pdf().from(element).save('my-pdf.pdf');const html2pdf = require('@koukitsuko/html2pdf.js');
// Generate PDF from element
const element = document.getElementById('element-to-print');
html2pdf().from(element).save('my-pdf.pdf');For detailed API documentation, options, and advanced usage, please refer to the original html2pdf.js documentation.
# Install dependencies
pnpm install
# Build development version
pnpm run dev
# Build production version
pnpm run build- Clone the repository
- Install dependencies with
pnpm install - Make changes to files in the
srcdirectory - Build with
pnpm run build - Test your changes
- Submit a pull request
This project is a fork of html2pdf.js by Erik Koopmans.
Copyright (c) 2017-2019 Erik Koopmans <http://www.erik-koopmans.com/>