iTextSharp get PDF DPI

10,678

Solution 1

PDF's do not necessarily use DPI in their definitions. PDF's allow the document creator to define their own user coordinate space which may or may not map to anything similar to Dots Per Inch.

Solution 2

Check this How to calculate the correct image size in out pdf using itextsharp ?

PDF UserUnit shall give the size of default user space units, in multiples of 1 ⁄ 72 inch.

ISO-32000-1 (section 8.3.2.3) tells us

“the default for the size of the unit in default user space (1/72 inch) is approximately the same as a point (pt), a unit widely used in the printing industry. It is not exactly the same; there is no universal definition of a point.”

Conceptually, user space is an infinite plane. Only a small portion of this plane corresponds to the imageable area of the output device: a rectangular region defined by the CropBox entry in the page dictionary. The region of default user space that is viewed or printed can be different for each page.

Coordinates in user space (as in any other coordinate space) may be specified as either integers or real numbers, and the unit size in default user space does not constrain positions to any arbitrary grid. The resolution of coordinates in user space is not related in any way to the resolution of pixels in device space.

Share:
10,678
aherrick
Author by

aherrick

http://twitter.com/andrew_herrick http://andrewherrick.com Run, code, slick.

Updated on June 04, 2022

Comments

  • aherrick
    aherrick almost 2 years

    How can I get the DPI of the PDF that I am reading from my hard drive into iTextSharp?

  • StayOnTarget
    StayOnTarget about 5 years
    This answer seemed to have copied text from somewhere else (which I also found used here: stackoverflow.com/a/14588654/3195477) so I have added an attribution.