r/FlutterDev • • Oct 26 '26

Article Generating a PDF from scratch

I wrote an article (without AI) about how to create a PDF document in Dart. Mainly because I wanted to share the fact that this isn't as hart as you might think – at least if you don't want to display text.

This is part 1 of 2. Part 2 is about using the Courier font. Supporting all TrueType fonts might be more practical, but parsing TTF files to acces the glyph measurements takes more code than everything I wrote so far and then you want to rewrite the TTF to support subsetting.

9 Upvotes

1 comment sorted by

4

u/usabledownside68 Oct 26 '26

Since the article focuses on PDF structure rather than text rendering, it makes the whole thing way more approachable. Parsing TTF glyph data and subsetting fonts is a rabbit hole most people don't realize until they're already in it. Curious to see how part 2 handles the Courier approach without dragging in the full font-parsing mess.