Show HN: TinyPDF – 3kb pdf library (70x smaller than jsPDF)
Posted by lulzx 1 day ago
I needed to generate invoices in a Node.js app. jsPDF is 229KB. I only needed text, rectangles, lines, and JPEG images.
So I wrote tinypdf: <400 lines of TypeScript, zero dependencies, 3.3KB minified+gzipped.
What it does:
- Text (Helvetica, colors, alignment)
- Rectangles and lines
- JPEG images
- Multiple pages, custom sizes
What it doesn't do:
- Custom fonts, PNG/SVG, forms, encryption, HTML-to-PDF
That's it. The 95% use case for invoices, receipts, reports, tickets, and labels.
GitHub: https://github.com/Lulzx/tinypdf
npm: npm install tinypdfComments
Comment by RodgerTheGreat 9 hours ago
docs/demos: https://beyondloom.com/decker/pdf.html
browsable source: https://github.com/JohnEarnest/Decker/blob/main/examples/dec...
Comment by layer8 8 hours ago
Comment by culi 8 hours ago
https://github.com/bubkoo/html-to-image
It's probably the most impressive and seamless experience I've had with converting HTML to pdfs/images so I just wanted to sing its praises here
Comment by normie3000 3 hours ago
Comment by andai 10 hours ago
My page layout code was like 50 lines of code. And I remember thinking... OK they already wrote 8,000 lines of code... They couldn't have added 50 more?!
400 lines though. Respect. I will take a proper look at this when I recover from burnout :)
Comment by anilgulecha 19 hours ago
I think if you have a markdown->PDF function included, where I can send in markdown and get PDF, that would solve quite many needs, and would be useful.
Comment by lulzx 19 hours ago
Comment by nebezb 10 hours ago
https://github.com/Lulzx/tinypdf/commit/961e6b602f19e125f210...
Comment by pylotlight 7 hours ago
Comment by wg0 9 hours ago
Comment by userbinator 2 hours ago
Comment by raybb 6 hours ago
Here's the TS library: https://github.com/Myriad-Dreamin/typst.ts
Comment by copypaper 4 hours ago
Comment by IntelliAvatar 1 day ago
Comment by wonger_ 11 hours ago
Comment by lysace 10 hours ago
Comment by teaearlgraycold 9 hours ago
Comment by winterec 5 hours ago
Comment by croisillon 11 hours ago
Comment by esafak 11 hours ago