You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PDF document creation is stuck in the past - from clunky Word docs to complex LaTeX to outdated tools. htmldocs brings document generation into 2025 with a modern developer experience using the tools you already love: <b>React</b>, <b>TypeScript</b>, and <b>Tailwind</b>.
12
+
PDF document creation is stuck in the past, from clunky Word docs to complex LaTeX to outdated tools. htmldocs brings document generation into 2025 with a modern developer experience using the tools you already love: **React**, **TypeScript**, and **Tailwind**.
16
13
17
-
## Why
14
+
## 🚀 What is htmldocs?
18
15
19
-
htmldocs is a modern toolkit for building documents with the web:
16
+
htmldocs is a local document editor and preview server to help you _create_ PDFs with React. It provides all the structural benefits of LaTeX with the familiarity of HTML and CSS. With htmldocs, you can use JSX to build document templates (invoices, reports, contracts, etc.) and generate PDFs just by passing data as props. htmldocs has:
20
17
21
-
-**Styling**: Use modern CSS properties to create visually stunning documents with web-like flexibility.
18
+
- 📌 Support for the latest CSS features like margin boxes and flexbox
19
+
- 🧩 A collection of unstyled components to help you layout your documents
20
+
- 📄 JSX templating system for building dynamic documents
21
+
- 🔗 Full TypeScript support for type safety
22
+
- ⚡ Dynamic data integration through props and APIs
23
+
- 📊 Real-time preview server with hot reloading
22
24
23
-
-**Structure**: Create clean layouts using HTML's powerful tools like flexbox, grid, and tables.
25
+
## 💡 Example
24
26
25
-
-**External Libraries**: Seamlessly integrate web libraries like FontAwesome, Bootstrap, and KaTeX
27
+
To see the full power of htmldocs, here is how you might build a dynamic invoice document template with JSX template variables:
26
28
27
-
-**Dynamic Templates**: Leverage JSX to create reusable document templates with dynamic content:
28
-
```jsx
29
-
functionInvoice({ customer, items, total }) {
30
-
return (
31
-
<Document>
32
-
<Page>
33
-
<h1>Invoice for {customer.name}</h1>
34
-
{items.map(item=> (
35
-
<LineItem {...item} />
36
-
))}
37
-
<Total amount={total} />
38
-
</Page>
39
-
</Document>
40
-
);
41
-
}
42
-
```
29
+
<imgsrc="https://github.com/user-attachments/assets/40e4ec91-e5eb-483a-ba28-14c6fd57ad8b"alt="Invoice template with htmldocs"width="100%" />
43
30
44
-
-**Data-Driven Documents**: Generate documents programmatically by passing data through props or fetching from APIs. Perfect for invoices, contracts, and reports that need dynamic content.
31
+
To change the customer details, all you need to do is render the `Invoice` component with different props:
45
32
46
-
-**Version Control**: Track document changes using Git and other version control systems
To create your first htmldocs project, run the following command:
53
56
@@ -57,25 +60,7 @@ npx htmldocs@latest init
57
60
58
61
For further instructions or to integrate htmldocs into your existing project, refer to the [Getting Started](https://docs.htmldocs.com/getting-started) guide.
htmldocs is a modern toolkit for building documents with web technologies. It automatically handles the layout and chunking of your document into pages, templating variables using JSX, and hot-reloading your document.
74
+
## ⚙️ How it works
92
75
93
76
htmldocs is built upon Chromium's rendering engine, which means it can render any HTML, CSS, and JavaScript. This is different from other tools like [wkhtmltopdf](https://wkhtmltopdf.org/), [WeasyPrint](https://weasyprint.org/), and [Prince](https://www.princexml.com/), which only support a subset of HTML and CSS.
94
77
95
78
htmldocs also uses the [Paged.js library](https://pagedjs.org/) under the hood. Paged.js is used for layout and chunking, as well as more modern features like margin boxes that aren't fully supported by the W3C's CSS standard.
0 commit comments