html2realpdf converts an HTML string or mounted element into PDF bytes. The public JavaScript package calls a Zig renderer compiled to WebAssembly.
Start here
Choose an API
| API | Use it when |
|---|---|
renderPdf | You need a direct render with the package default Worker renderer. |
createRenderer | You render more than once, register fonts, choose the execution backend, or need explicit renderer disposal. |
html2pdf | You are moving a supported PDF workflow from html2pdf.js. |
Every successful render returns a PdfDocument. Export or download its bytes, then call dispose().
Input and output
The input can be an HTML string, a mounted Element, or a ref-shaped object with a current element. Mounted elements preserve computed styles and live browser state.
The output contains PDF bytes, a page count, and structured diagnostics. Supported text, links, and vector graphics remain native PDF content.
Read by task
- Configure page geometry and rendering
- Register fonts
- Control pagination
- Load images and stylesheets
- Preview a generated PDF
- Check current limitations
- Troubleshoot a render
LLM index
Use the LLM documentation index to give an agent the complete documentation tree, page URLs, and descriptions in a compact text file.