Copy link to clipboard
Copied
Hi, I'm looking for a way to calculate how may words are on each page of a pdf rather than the whole document.
Does anyone know if getPageNumWords could be used to do this?
The query would need to recognize the position of the cursor in order to define the "current page" - is that possible?
Many thanks.
Copy link to clipboard
Copied
That's exactly what this function does. Use this code to retrieve the number of words in the current page (the one being viewed, not necessarily where the cursor is located):
this.getPageNumWords(this.pageNum)
Copy link to clipboard
Copied
Use this:
var numWords = this.getPageNumWords(this.pageNum);
app.alert("There are " + numWords + " words in this page.", 3);
Copy link to clipboard
Copied
... or if not the position of the cursor then some other way of recognizing the individual page to do the calculation for.
Copy link to clipboard
Copied
That's exactly what this function does. Use this code to retrieve the number of words in the current page (the one being viewed, not necessarily where the cursor is located):
this.getPageNumWords(this.pageNum)
Copy link to clipboard
Copied
Brilliant, thanks a mill!
Copy link to clipboard
Copied
This does the job in console.... I'm just wondering how I might get it to output to a popup window, something like:
app.alert("There are " x " words in this page.");
Sorry - I really don't understand Javascript at all!
Copy link to clipboard
Copied
Use this:
var numWords = this.getPageNumWords(this.pageNum);
app.alert("There are " + numWords + " words in this page.", 3);
Copy link to clipboard
Copied
thanks so much... works like a charm 🙂
Copy link to clipboard
Copied
My free abracadabraTools adds a Word Counter item in Acrobat's Edit menu:
https://www.abracadabrapdf.net/utilitaires/utilities-in-english/abracadabratools_en/
Copy link to clipboard
Copied
sorry, but the document word count returns "0" and the page word count does nothing.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now