Hacker News new | ask | show | jobs
by schlowmo 1025 days ago
PDF is such a weird format. Not so long ago I had to write some Java code for manipulating PDFs: find a string, remove it and place an image at the former string position. I should have known better as I thought "Well, how hard can that be?”

What followed was a deep dive down the rabbit hole, a lot of fiddling with the same tools the author of this gist is using trying to make sense of it all.

The final solution worked better than I thought while at the same time felt incredibly wrong.

I'm very thankful for all the (probably painful) work that went into those open source PDF tools.

1 comments

> "Well, how hard can that be?”

Very hard?

I worked on a tool that generated PDFs based on API responses. The tool added charts from the api data.

Those PDFs were reports with some hardcoded text.

Yesh what a fun ride that was.

Generating PDFs are incredibly easy. I just generate LaTeX and run it through lualatex. When precise positioning is needed, I just use a giant tikzpicture.