I learned getting the image size using itextsharp pdf
the image size is the physical dimension before the image was inserted in the pdf.
Dim iwidth As Integer = tg.GetAsNumber(PdfName.WIDTH).IntValue
Dim iheight As Integer = tg.GetAsNumber(PdfName.HEIGHT).IntValue
When I extracted the image is very large, larger than the paper size.
But if you view the image inside the pdf with any pdf reader software, the image is small.
How can I get the designed image size inside the pdf?
Im using this code and I don’t know if is the proper, I don’t know the next think to do.
Dim pdfDesignedImage As iTextSharp.text.pdf.parser.InlineImageInfo
This is my 2nd account, I was wrong on first. Sorry about that.
I hope I can be better using this account.
There’s a poorly named Interface called
ITextExtractionStrategythat you can implement that will give you extended information when extracting things from a PDF. I say “poorly named” because although it says “text” it also supports images as well. This interface has 5 methods, 4 of which are text-based and you can just ignore. The method that you are interested in isRenderImage. Below is a full working implementation of this:To use this subclass we pass it to the (once again poorly named) method
iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(). Normally you’d call this method and assign the string result to a variable but in our case we don’t care about the text so don’t. To use it you would do this: