For a side project at home, I have several pdf documents in "standard" form (White background, black font for text). For several pages, I have footnotes which are different in size from the main body. Do you know a way to identify the text block in a document based on the font size?

  • $\begingroup$ you mean a scanned pdf ? a vector pdf would already be giving you the text font information... $\endgroup$ – Fat32 Oct 28 '19 at 9:19
  • $\begingroup$ A pdf generated from a text editing tool. $\endgroup$ – ChiPlusPlus Oct 28 '19 at 9:25
  • $\begingroup$ ok, then you should have vector meta data ? $\endgroup$ – Fat32 Oct 28 '19 at 9:35
  • $\begingroup$ For the purpose of the exercice, let's suppose that it is not . $\endgroup$ – ChiPlusPlus Oct 28 '19 at 10:02
  • $\begingroup$ Do you mean "personal project", or are you hiring, firing & promoting folks en mass? Edit for spelling? $\endgroup$ – TimWescott Oct 28 '19 at 20:09

For most fonts, just digitally smear the image horizontally, then look at the height of the resulting gray and white bars. Assuming typical text the frequency of capitals, descenders and ascenders should be small enough to just contribute a bit of gray.

A more sophisticated method would try to pick out the lines, then find the tips of the ascenders vs. the baseline. That would be the height of the font in pixels (or whatevers). Then find the height of each pixel (or whatever) in points, and you have the font height.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.