Settings

Theme

Show HN: TinyPDF – 3KB PDF library (70x smaller than jsPDF)

github.com

16 points by lulzx 21 hours ago · 3 comments · 1 min read

Reader

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 tinypdf
anilgulecha 4 hours ago

Great exercize, but for most use cases - people will continue reaching for jsPDF.

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.

IntelliAvatar 19 hours ago

3KB is wild. What features did you intentionally leave out to get this small?

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection