Hi!
I've a question to the current post. How can I check DPI of images contained by pdf file?
I'm trying to do something like this:
using (PdfDocument pdf = PdfReader.Open(sourcePdf))
{
for (int i = 0; i < pdf.Pages.Count; i++)
{
XGraphics xGraphics = XGraphics.FromPdfPage(pdf.Pages[i]);
float dpi = xGraphics.Graphics.DpiX;
}
}
but DPI is not correct.(For example it shows 96dpi while it should be 150dpi).
I've also tried to get such info from XObject dictionary but there're no such property like DPI
PdfDocument pdf = PdfReader.Open(sourcePdf);
PdfDictionary pg = pdf.Pages[0];
PdfDictionary res = pg.Elements.GetDictionary("/Resources");
PdfDictionary xobj = res.Elements.GetDictionary("/XObject");// there're width, height and so on but no dpi