To use Image-XChange, you need to add the following declarations in your code:
Code: Select all
Private Declare Function IMG_PageGetSize Lib "ixclib40.dll" (ByVal page As Long, ByRef width As Long, ByRef height As Long) As Long
Private Declare Function IMG_PageGetDPI Lib "ixclib40.dll" (ByVal page As Long, ByRef xDPI As Long, ByRef yDPI As Long) As Long
Private Declare Function IMG_PageCountColors Lib "ixclib40.dll" (ByVal page As Long, ByRef pageRect As rect, ByRef numColors As Long) As Long
And now, when you have an image handle returned by this call:
Code: Select all
res = PXCp_GetDocImageAsXCPage(hPDF, ImageHandle, im)
you can get an image dimension (in pixels):
Code: Select all
Dim iwidth As Long
Dim iheight As Long
res = IMG_PageGetSize(im, iwidth, iheight)
and colors count
Code: Select all
Dim ir as rect
Dim ncolors as Long
ir.left = 0
ir.right = iwidth
ir.top = 0
ir.bottom = iheght
res = IMG_PageCountColors(im, ir, ncolors)
you can also get DPI (using
IMG_PageGetDPI), but as said, images within a PDF do not store DPI information (only a JPEG may preserve this info), so, you will get 0 in most cases.
If you currently do not have license for Image-XChange, but have PRO license for the PDF-XChange SDK, please contact
sales@pdf-xchange.com to get your Image-XChange license - though you can download and test it in trial mode without the license key.
HTH