pdfn
v0.9.1
Published
Dev server and PDF generation for print-ready PDFs
Maintainers
Readme
pdfn
Dev server and CLI for pdfn. Run with npx — no install needed.
Commands
pdfn dev
Start dev server with live preview:
npx pdfn dev # Start on port 3456
npx pdfn dev --open # Open browser automaticallyOptions:
| Flag | Default | Description |
|------|---------|-------------|
| --port | 3456 | Port for the dev server |
| --open | — | Open browser automatically |
| --mode | — | Load additional .env.[mode] files |
pdfn add
Add templates to your project:
npx pdfn add invoice # Add invoice template
npx pdfn add invoice --tailwind # With Tailwind classes
npx pdfn add --list # List available templatesTemplates: invoice, letter, contract, ticket, poster, report
Usage
import { pdfn } from '@pdfn/react';
import Invoice from './pdfn-templates/invoice';
// Local dev (uses localhost:3456)
const client = pdfn();
// Or pdfn Cloud
// const client = pdfn(process.env.PDFN_API_KEY);
const { data, error } = await client.generate({ react: <Invoice /> });
if (error) {
console.error(error.message);
return;
}
// Use data.bufferLicense
MIT
