Get DPI of PDF

Hello,


Is there a way to get the DPI of an existing PDF file using Aspose?
Considering the fact that we may not be able to get exactly the DPI, is there any calculation that give me an approximate value?

Thanks in advance!
At,

Hi Alexandre,


Thanks for your inquiry.

Please note that PDF files are DPI independent and it completely depends upon the device where PDF files are going to be rendered. As far as measurement of the PDF file is concerned, you can measure PDF files in PPI (Points Per Inch) using Aspose.Pdf API. The properties of Height and Width return size in points i.e 72 points = 1 inch.

Moreover, Aspose.Pdf API generates PDF DPI independent from other file formats, however when you try to get/measure size information or set watermark images the API renders the PDF in 72 DPI resolution to perform the task.

In case if you need any further assistance, please feel free to contact us.


Best Regards,

Ok, understood.


I appreciate your fast answer. Thanks!

At,

Hi Alexandre,


Thanks for your feedback. In case of any other inquiry, please feel free to contact us. We will be more than happy to extend our support.


Best Regards,

There is sample code on the Aspose.PDF for .NET documentation: Get Resolution and Dimensions of Images|Aspose.PDF for .NET

@dbirdz

The code example is to get resolution and dimensions of embedded images in the PDF. In case you want to determine the DPI of PDF Page (containing text or other elements), please consider our previous response in this discussion.

@asad.ali
Yes you’re right, I didn’t read properly. However I came here from a google search where I hoped to find the documentation I posted in the link, so maybe someone else happens to come here looking for the same thing I was and will see my post… who knows!

1 Like

@dbirdz

Sure. Your post would definitely help others looking for the similar functionality. Thanks for sharing your findings.