What type of unit is using PdfPig by default #387
Replies: 1 comment
-
Units in PDFs are by default 72 pixels/inch:
Word sizes are based on the bounds of the contained letters so not all words will have the same size due to ascenders and descenders. See https://github.com/UglyToad/PdfPig/wiki/Letters. However it sounds like the library might have calculated letter sizes incorrectly for your document? |
Beta Was this translation helpful? Give feedback.
-
Hi, I just want to know what type of unit is being used by default when getting bounding boxes or bounds rectangles width and height (millimeters, points, presentation etc).
I have an Image and words in a pdf, the image is (145px X 41px) its Bounding Box or bounds rectangle width and height is (108.84318266486721 X 30.776347597652148). The closest values I could get, was transform from px(pixels) to point, or from presentation to point getting in both cases (108.75 X 30.75) but as you can see the decimals are wrong.
In case of the words the height is different from word to word which is kind of strange to me since the words use all the same font, but using the "DefaultPageSegmenter" I get a block for all the words that has (561.199975284904 X 7.8986808096776713),
my page width and height in points units that is defined by default by PdfPig is (612pt X 792pt) and converting the whole word block to points using the previously mentioned case from px(pixels) to point, or from presentation to point I get (420.899981 X 5.924011) in this case the the height is only 5.924011pts that is wrong, its too small the closest value I could get to what its height should be in points units was from transforming from millimeters to points getting (1590.80308 X 22.389961), now in this case the height is close to what it should be but the width is wrong its even bigger than the page width.
Please can someone help me?
Beta Was this translation helpful? Give feedback.
All reactions