views:

53

answers:

1

On my website, I display uploaded PDF files in a flash player for my users to read.

I already use various tools to extract the text and produce a serious of high quality images from the file and the system works well.

The last piece of the puzzle is to be able to highlight specific parts of the document to help users with accessibility issues.

However I cannot figure out how to calculate where the specific text is positioned on the page?

Notes:

  • The documents uploaded to the system are from 3rd parties, so fonts may be embedded. Meaning that I cannot be sure of the width of specific letters.
  • The text to be highlighted may not be unique, the same text may be repeated

How can I calculate the coordinates, height and width of a specific piece of text on a PDF, so that I can then draw a box around it?