Skip to main content

Convert HTML to DOCX, PDF, and More

A modular TypeScript library for generating rich, styled documents from HTML — with extensibility at its core.

Get Started

Install and use the library in your TypeScript/JavaScript project:

npm install html-to-document

import { init, DocxAdapter } from 'html-to-document';

const converter = init({
adapters: {
register: [
{ format: 'docx', adapter: DocxAdapter },
],
},
});

const parsed = await converter.parse('<h1>Hello</h1>');
const docx = await converter.convert(parsed, 'docx');

Try the live TinyMCE integration demo:
🔗 html-to-document-demo.vercel.app →

🧱 Modular Architecture

Compose your own converter pipeline using adapters, style mappings, and custom middleware.

📄 Professional Output

Generate DOCX, PDF, or other document formats with full control over layout and styles.

💡 Developer-Friendly

Written in modern TypeScript with full typings, clean APIs, and extensibility in mind.