r/webdev • u/danmolitor • Mar 28 '26
Showoff Saturday [Showoff Saturday] I built a PDF generation tool that runs in the browser, on the edge, and in Node – no Puppeteer, no Chrome
Hey r/webdev, I've been building Forme for the past couple months and wanted to share what it's become.
Problem: If you need PDFs in JavaScript you're probably using Puppeteer and dealing with slow cold starts, Lambda layer nightmares, and page breaks that randomly break. Or you've tried react-pdf and hit its layout limitations.
What Forme does:
- JSX component model - write PDFs like you write React components
- Rust engine compiled to WASM - runs anywhere JS runs (Node, Cloudflare Workers, Vercel Edge, browser)
- Real page breaks - tables split across pages automatically, headers repeat, nested flex layouts just work. No more break-inside: avoid and hoping for the best.
- ~80ms average render time vs seconds with Puppeteer
- AI template generation - describe a document or upload an image and get a JSX template back
- VS Code extension with live preview
Two ways to use it:
Open source (self-hosted):
npm:
npm install @formepdf/core @formepdf/reactThe engine is open source and runs anywhere WASM runs. No API key, no account, no limits.
Hosted API + dashboard: There's also a hosted option at app.formepdf.com with a REST API (TypeScript, Python SDKs), template management, and a no-code mode for non-technical users who need to fill in and send invoices directly. Free tier available.
Try it without signing up: formepdf.com has a live demo where you can edit JSX and see the PDF render in your browser instantly.
tsx
import { Document, Page, Text, Table, Row, Cell } from '@formepdf/react';
export default function Invoice({ data }) {
return (
<Document>
<Page size="Letter" margin={48}>
<Text style={{ fontSize: 24, fontWeight: 700 }}>
Invoice #{data.invoiceNumber}
</Text>
<Table>
<Row header>
<Cell>Description</Cell>
<Cell>Amount</Cell>
</Row>
{data.items.map(item => (
<Row key={item.id}>
<Cell>{item.name}</Cell>
<Cell>${item.amount}</Cell>
</Row>
))}
</Table>
</Page>
</Document>
);
}GitHub: github.com/danmolitor/forme
VSCode Extension: https://marketplace.visualstudio.com/items?itemName=formepdf.forme-pdf
Would love feedback - issues, feature requests, anything - especially from anyone who's fought with Puppeteer in serverless environments or hit react-pdf's layout limitations.



4
u/reddit-poweruser Mar 29 '26
Any accessibility conformance built in? That's been the deal breaker for most pdf generation libraries for us
30
u/VolumeActual8333 Mar 28 '26
Serverless PDF generation has been cursed territory for years—either you accept 10-second cold starts with Puppeteer or you fight react-pdf's flexbox bugs. A WASM engine that handles tables splitting across pages with repeating headers solves the exact pain point that kept Chrome-based solutions in production despite the bloat. Running this on Cloudflare Workers without hitting the 50MB binary limit is going to pull a lot of people out of Lambda layer hell.
3
u/NextMathematician660 Mar 29 '26
This is a very interesting product! Why limit to developer only? I know lots of end user need such capability, some of them just want to build a receipt, statement, or quote. They need to author a simple template, and connect to their data. This could be very useful in that situation.
I'm currently working on a product that remotely related to this. Maybe we can collaborate. https://www.docmentis.com/
2
u/[deleted] Mar 29 '26
Thank you man that's really nice of you I will give you my feedback in 2 or 3 days thank you alot
2
u/makproductions Mar 29 '26
Love this ! Will give it a try
2
u/txmail Mar 30 '26
This looks awesome. I have actually been building a module for a client's platform that I think is similar and I am only a few weeks into the build -- the one I am working on is more "drag and drop" style with another module that lets them use dynamic fields generated from their database.
The PDF generation is just me using a small PDF library to generate the cells and place the elements. For the dynamic fields there is a big render engine I am working on because sometimes they might have used a field, that by other rules will not actually be included in the final output so I have to remove the field and adjust the spacing and page breaks etc. using a set of rules based on where they drug stuff on the form).
Anyway - am I seeing this right that this is more of a "make the form template in code" and then your render engine handles translating that code into a PDF? Like -- for example in the GIF that is show, if you wanted to add a new field to the invoice form you would need to write that field in code, you cannot just like right click on the editor and say add field and then drag it around where you want it?
2
u/tundra_cool Mar 30 '26
very nice! have you considered redaction implementation? pymupdf and soffice have been my gotos on that but they're restricting in many ways themselves. thanks for sharing
2
u/lacymcfly Apr 04 '26
the WASM approach is really smart for this. I've been burned by Puppeteer cold starts on Lambda before, sometimes 8-12 seconds just to boot. what does the WASM bundle size look like? curious if it affects initial load times on edge deployments
2
u/trojanvirus_exe Mar 28 '26
what theme is that
1
u/danmolitor Mar 30 '26
Update: v0.8.0 shipped today with AcroForms, PDF/UA-1 accessibility, PDF/A archival, and digital signatures, among some other things. Had some questions in the comments asking about these - they're all in now. https://github.com/danmolitor/forme/releases/tag/v0.8.0
1
u/[deleted] Mar 28 '26
I hope you make a rust crate too because believe it or not I recently needed to generate pdfs with svgs and pictures using tools in rust and there was none that supported all the requirement which resulted to me switching to javascript libraries that were way advanced than the rust ones
1
u/Eveerjr Mar 29 '26
Does it support form inputs?
1
u/Final-Choice8412 Mar 29 '26
Just curious how much was claude successful with generating code for this?
1
u/Altruistic-Panic-271 Mar 29 '26
So for a11y, are the elements tagged correctly, alt texts and meta info tags added? That annoyed me with puppeteer. It's not a11y guidelines conform.
1
u/RyanBThiesant Mar 31 '26
Do you export a PDF instead of a file that pretends to be a PDF. If it does, a proper PDF, I am happy.
1
u/skratlo Mar 28 '26
Just use Typst
3
u/Kindly-Vanilla-6485 Mar 29 '26
i've never seen something this amazing before. kinda feels illegal to make it opensource.
2
u/Mexicola33 Mar 29 '26
Would’ve loved this at my old job.
2
u/RussianDisifnomation Mar 29 '26
Instantly favorites
1
u/0xjj_official Mar 29 '26
that's great
1
u/PhDumb Mar 29 '26
Very nice. I think the difficult part for the template building is to get the relevant JSX component. One can upload any small PDF into this tool and click "Convert to code". The tool is free but with the usage limits
1
u/RyanBThiesant Apr 09 '26
you have to pay to get the spec to make pdfs from the pdf iso group.
1
u/hillac Apr 10 '26
So this implements a custom layout engine where you can only use the provided components and their props, so migrating over to it means id need to rewrite my react pdfs?
1
u/earonesty May 14 '26
wasm is a non-starter for me
1
u/earonesty Jun 11 '26
https://www.npmjs.com/package/boxpdf-html is, hands-down, the fastest/streaming pure-js html renderer
-2
u/Rhack2021 Mar 28 '26
The JSX component model is the right call. Puppeteer-based PDF generation on serverless is a constant source of pain — cold starts, memory limits, and Chrome binary size all fighting you. Having something that works at the edge without a headless browser is a real gap in the ecosystem. How does it handle complex table layouts across page breaks?
6
u/[deleted] Mar 28 '26
[removed] — view removed comment
1
u/[deleted] Mar 29 '26
[removed] — view removed comment