Navigation

Chennai, India

All work
tools / case studyLocal tool

pagefit

Reduce wasted space in generated PDFs

I worked on a PDF tool that checks the pages after rendering. It adjusts spacing within set limits, then keeps the change only if it reduces wasted space without shrinking the text too far.

Inputs
Markdown, Typst and web pages
Runs
Locally
Feedback
Page-fill report

Generated PDFs often leave large gaps or push a small section onto another page. pagefit checks the result and tries another layout when there is room to improve it.

My contribution

I defined the layout problem, readability limits and output checks. AI tools helped implement the tool.

01

Look at the finished pages

The tool converts Markdown, Typst or a web page to PDF, then measures how much of each page's text area is used.

Headers and footers are excluded. Including a page number at the bottom would make an almost empty page look full.

02

Stop before the text gets too small

I set limits on type size and margins. The tool tries slightly tighter settings and keeps them only if page count or fill improves.

If it cannot absorb an awkward page within those limits, that page stays.

03

The documented example

The repository records a study document changing from 26 pages to 17, with mean page fill rising from 72% to 96%. That result belongs to that document.

The code and instructions are public. The tool runs locally and reports what the layout loop changed.

04

Checking more document types

Long tables, quotations and illustrated pages need different checks. A useful next test set would compare page count with the actual reading experience, including broken tables and stranded headings.

Up next

SamsMind

A public map of notes from my second brain

Back to all work