Feature Request: Access to Font Size of Text Elements #358
-
Is your feature request related to a problem? Please describe. Describe the solution you'd like Describe alternatives you've considered I’ve considered post-processing the bounding boxes and estimating the font size heuristically based on height, but this is unreliable. Other libraries like pdfminer.six provide font size information, but they are heavier and less performant compared to pypdfium2. Additional context
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I believe this is possible with the raw API (namespace At a quick glance, I can find e.g. The readme has instructions how to work with the raw APIs. |
Beta Was this translation helpful? Give feedback.
I believe this is possible with the raw API (namespace
pypdfium2.raw
), and some downstreams are already doing it (e.g. VikParuchuri's pdftext).At a quick glance, I can find e.g.
FPDFText_GetFontSize()
,FPDFText_GetFontWeight()
,FPDFText_GetFontInfo()
.Check out pdfium's headers for more info, particularly
fpdf_text.h
.The readme has instructions how to work with the raw APIs.