For PDFs that have been converted from Word files, I'm investigating how I can extract footnotes. One approach I'd like to validate the possibility of is writing a search that looks for footnotes in the text (understanding that "text" is not a straightfoward concept in a PDF). I've been looking at:
for scripting options.
I'm wondering if I could first do a search for a number - e.g. 1 and then either determine the rectangle shape and relative offset to determine if it's a footnote reference; or if text properties are available, the superscript property (if there is one). If it finds a footnote reference, follow on to find the actual footnote content at the bottom of the page and extract that.
You can search for words and their location.
To do that you would need to use the getPageNthWord and getPageNthWordQuads methods.
However, you can't find any additional information about them, like the font used, color, size, whether or not they are superscript, underline, italic, bold, etc.
Thanks for your reply.
Would I do a search and then call getPageNthWord to get more information? Without doing the search I won't know what index the word is (using this reference, which may be out-of-date: https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/AcrobatDC_js_api_reference.pdf)
Or would I iterate through every word?
No, this has nothing to do with the search command. You use this method in a loop to iterate over all the words in the file, looking for a match.
Yes, you can look at the position of the word, using the getPageNthWordQuads method.
It works at the word-level only, though.
And of course it uses the same indexes as the getPageNthWord method...
That's great - thank you - I'll give that a go. Do you have any suggestions for other approaches to the extraction?
If you need to know the location of the word that's the only way (using a script).