HTML to PDF in the browser — one line of code for selectable, searchable vector PDFs (10,000+ pages). Pure frontend: zero backend, zero runtime deps. TypeScript over a Rust + WebAssembly engine; an html2canvas/jsPDF alternative.
See the codePure-frontend DOM-to-PDF engine powered by TypeScript, Web Workers, Rust, and WebAssembly.
Documentation | Live Demo | PDF Editor | 中文文档
npm install dompdf.js
<script src="https://cdn.jsdelivr.net/npm/dompdf.js@latest/dist/dompdf.min.js"></script>
import dompdf from "dompdf.js";
const element = document.querySelector("#content");
const blob = await dompdf(element, {
format: "a4",
pagination: true,
backgroundColor: "#ffffff",
});
const url = URL.createObjectURL(blob);
window.open(url, "_blank");
setTimeout(() => URL.revokeObjectURL(url), 30_000);
Comprehensive bilingual interactive documentation and detailed API references have been migrated to the standalone docs page:
Covered topics:
Please read CONTRIBUTING.md before submitting a PR, and run at least:
npm test
npm run build
Please report security issues according to SECURITY.md. Do not disclose unpatched vulnerabilities in public issues.
See CHANGELOG.md for recent version changes.
This project is open-sourced under the MIT License.
HTML to PDF in the browser — one line of code for selectable, searchable vector PDFs (10,000+ pages). Pure frontend: zero backend, zero runtime deps. TypeScript over a Rust + WebAssembly engine; an html2canvas/jsPDF alternative.
See the codePure-frontend DOM-to-PDF engine powered by TypeScript, Web Workers, Rust, and WebAssembly.
Documentation | Live Demo | PDF Editor | 中文文档
npm install dompdf.js
<script src="https://cdn.jsdelivr.net/npm/dompdf.js@latest/dist/dompdf.min.js"></script>
import dompdf from "dompdf.js";
const element = document.querySelector("#content");
const blob = await dompdf(element, {
format: "a4",
pagination: true,
backgroundColor: "#ffffff",
});
const url = URL.createObjectURL(blob);
window.open(url, "_blank");
setTimeout(() => URL.revokeObjectURL(url), 30_000);
Comprehensive bilingual interactive documentation and detailed API references have been migrated to the standalone docs page:
Covered topics:
Please read CONTRIBUTING.md before submitting a PR, and run at least:
npm test
npm run build
Please report security issues according to SECURITY.md. Do not disclose unpatched vulnerabilities in public issues.
See CHANGELOG.md for recent version changes.
This project is open-sourced under the MIT License.