pdf2json icon indicating copy to clipboard operation
pdf2json copied to clipboard

bounding boxes

Open shaunc opened this issue 9 years ago • 2 comments
trafficstars

Could the documentation explain how to calculate bounding boxes for text items?

Text has x, y and w but no h. I presume that the font size could give you h, but they seem to be in other units. How should I convert?

BTW, what is the "TS" element? Can this help me?

shaunc avatar Apr 10 '16 20:04 shaunc

TS is 'Text Style', line 332 in pdffont.js: let TS = [this.faceIdx, this.fontSize, this.bold?1:0, this.italic?1:0].

Since embedded font is not supported in parser, bounding box is determined by rendering platform. For example, in browser rendering, it's Element.getBoundingClientRect()

modesty avatar Apr 16 '16 17:04 modesty

Is it possible to get the bounding rectangle without rendering the document? I am using the module to scan a PDF and extract text at specific locations which I would like to derive from they're bounding rectangle.

SPlatten avatar Jun 21 '17 09:06 SPlatten