npx pdfn add invoice (see Quickstart).
Template structure
Every template is a React component that exports aDocument containing one or more Page components:
pdfn-templates/my-template.tsx
pdfn-templates/ and it will appear in the dev server preview (npx pdfn dev).
Document
The root wrapper for every PDF template. Sets metadata and loads custom fonts.Document props
Fonts
Pass font names for Google Fonts, or font config objects for local files:Page
Defines a page with size, margins, headers, footers, and content.Page props
Page sizes
Margin formats
Watermark formats
PageNumber
Displays the current page number. Use in headers or footers.className prop for styling.
TotalPages
Displays the total page count. Combine withPageNumber for “Page 1 of 5” style footers.
className prop for styling.
PageBreak
Forces content after it to start on a new page.NoBreak
Keeps its children together on the same page. If the content doesn’t fit, it moves to the next page as a unit.Thead
For tables that span multiple pages, useThead to make headers repeat on each page.
Thead repeats headers on each page by default. Pass repeat={false} to disable.
Standard HTML
<thead> works but won’t repeat headers across pages. Use Thead for multi-page tables.Next steps
Generate & Render
Client setup, generate() and render() parameters
Styling
Tailwind CSS, custom CSS, and inline styles