|
Good question.
We have two functions in QPL for finding images and they work in different ways.
FindPages() and GetPageImageList()
1. FindPages will search through the Resources dictionary for each image on the page and then report back each image object/stream that was found in the PDF. It will only report the image once even if the image is used many times on the same page or on multiple pages. It cannot tell you if the image is used or not, cannot tell you exactly on which page it it used or even the size it is used at for rendering. It just reports the raw image properties - it cannot report scaling, rotation etc. It does have access to the DPI setting of the raw image data. If you render the image then the DPI used will be different to this DPI as scaling, rotation etc will afftect the actual rendered DPI.
2. GetPageImageList will do a fast render of the current page and report back any and all images that were processed during the quick render process. If the same logo is used on the top and bottom of the page then this image will be reported twice.
You can use the GetImageListItemIntProperty function to return the image width and height in pixels (option 401 and 402 respectively). You can also use the GetImageListItemDblProperty to determine the size of bounding box that the image was used to draw the image.
DPIx = width in pixels / bbox.width * 72.0; DPIy = height in pixels / bbox.width * 72.0;
or
DPIx = GetImageListItemIntProperty(401) / (QP.GetImageListItemDblProperty(503) - (QP.GetImageListItemDblProperty(501)) ;
DPIy = GetImageListItemIntProperty(402) / (QP.GetImageListItemDblProperty(504) - (QP.GetImageListItemDblProperty(502)) ;
This is assuming that the image box is not rotated for any reason.
As for getting the ImageID and using it with the other image functions - I will need to do some consulting with the programmers and some testing to see what might be possible in the future.
I hope that helps. Do you have a reason why you think the ImageID would be good to have or does FindImages solve that problem for you ?
Andrew.
|