How to determine what is the closest text to an image?

Q: I noticed that there are functions to extract images and texts from
PDF files. But is there a way to get a piece of text which is closest
to the image? Because most likely, that text contains some description
about the image. And I need that information to be indexed in the

Using PDFNet SDK you can obtain positioning information for every
element (e.g. text, images, vector art) on the page. You can also used
element.GetBBox(rect) to quickly obtain a bounding box for each
element. Although the there is not built-in function to determine what
is the closest element to a given image, this should not be difficult
to implement using the existing API. You can also traverse the display
list multiple times (e.g. the first time to get boundig boxes and the
secong time to extract the N-th text element from the list).