Interesting. Two engineers at Apple worked on something similar that would slurp character bounding boxes from a PDF page and reconstruct paragraphs, columns, tables, etc.
It was surfaced in iOS a decade ago as "tap to zoom" feature for PDFs. It's funny — as with a lot of things there was a lot of sophisticated engineering under the hood and then marketing simply wants it to detect a tap in a paragraph and zoom to its bounds.
I can't think of the last time I read a PDF on my phone or I would test it to see if it still works as I remember.
One of those engineers came up with idea of using cluster analysis for word grouping. The other engineer realized that we had a k-cluster problem in the general case, but needed to figure out what k was. (In the simplest case it is 2 - letter gaps and word gaps). They used the differences between the anchor points of glyphs.
I think we're thinking the same thing, but this is one of those little features on modern smartphones that we used to take for granted. Being table to tap to zoom on a document and have it snap to the right spot was a big feature improvement, now we expect it.
I was there when we added it to Preview ;) I think Nils wrote the code to hook it up, because he also worked on the loupe and how it would automatically lock onto the bounding box of a line.
Hi, Matt. Yeah, one of the engineers is on HN from time to time — I thought he might see the post and respond. (Your reminding me of Nils made me smile this morning.)
Ahem. Actually what I am most proud of is that I made pinch to zoom keep characters focussed during zooming. At that time, Safari let things get blurry until the user stopped zooming and then it snapped to focus. That is what I was supposed to do, but I decided to use mipmaps instead.
Ha ha, no idea from your username.
Wow, I had no idea. That’s pretty cool. I don’t read a ton of pdfs on my phone, but I always find it super frustrating when that functionality is missing somewhere else.
I can confirm that tap to zoom and word higlight still works on many PDFs. PDF documents are so varied in structure that it is impossible to say that any technique always works.
Should there be a million-dollar prize for developing a way to parse and reflow the text in PDFs in real time? Reading PDFs on screens is a huge headache.
Various apps already do this, if you find yourself reading lots of PDFs on phones. For example I use PDF Expert on iOS to do this. It’s not perfect—depending on the quality of the PDF there might be weird artifacts in the reflowed text (e.g., “ff” ligatures getting mapped to the Unicode ligature character “Latin Small Ligature Ff (U+FB00)” which breaks copy/paste/search).
But for PDFs which are really hard to read on a phone otherwise, it’s really a nice investment.
I think there already might be implicitly, I think you could sell that as a product.
I often find myself making a screenshot and copy pasting from the image because selection in many apps is so broken. Especially for PDF, the iOS viewer has completely useless selection.
Not just PDFs, you can also do the same thing (double tap to zoom to a paragraph) in Safari on any web page.