Show HN: TinyPDF – 3KB PDF library (70x smaller than jsPDF)
a day ago
- #JavaScript
- #Library
- Minimal PDF creation library named tinypdf with <400 LOC and zero dependencies.
- Comparison with jsPDF: tinypdf is ~70x smaller (3.3 KB vs 229 KB) with no dependencies.
- Features include text (Helvetica, any size, hex colors), shapes (rectangles, lines), images (JPEG), and multiple pages.
- Excluded features: custom fonts, PNG/GIF/SVG, vector graphics, forms, encryption, compression, HTML-to-PDF.
- Use cases: invoices, receipts, reports, shipping labels, tickets, certificates, contracts, data exports.
- Example code snippets provided for creating PDFs, adding text, shapes, and images.
- Invoice generator example (~50 lines) demonstrating practical usage.