Dev server for React renderer for creating PDF files on the browser and server
pnpm install -D @uixdimi/react-pdf-preview
npm install -D @uixdimi/react-pdf-preview
yarn add -D @uixdimi/react-pdf-preview"scripts": {
"dev": "react-pdf --dir=src/templates --port=3000"
}- In order for the previewer to work, all templates must pass down the
DocumentPropsdown to the document. Eg:
export default function Quixote({ creator, ...props }: QuixoteProps) {
return (
<Document {...props} title="Don Quijote de la Mancha">
...
- Sometimes you might want to include components in your templates. Options are:
- Create
componentsfolder anywhere you need it, this way it will be ignored by the previewer. - Prefix component filenames with underscore.
See the example template here: ./templates/quixote.tsx
- @diegomura for the amazing @react-pdf/renderer
- @resend for the inspiration from react-email
MIT © Dimitar Mitov

