Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Words per PAGE javascript

Contributor ,
Feb 22, 2020 Feb 22, 2020

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.

<br>
~ David Sweeney-Bear ~
TOPICS
How to
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
2 ACCEPTED SOLUTIONS
Community Expert ,
Feb 22, 2020 Feb 22, 2020

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)

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2020 Feb 23, 2020

Use this:

 

var numWords = this.getPageNumWords(this.pageNum);
app.alert("There are " + numWords + " words in this page.", 3);

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 22, 2020 Feb 22, 2020

... or if not the position of the cursor then some other way of recognizing the individual page to do the calculation for.

<br>
~ David Sweeney-Bear ~
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 22, 2020 Feb 22, 2020

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)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 22, 2020 Feb 22, 2020

Brilliant, thanks a mill!

<br>
~ David Sweeney-Bear ~
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 22, 2020 Feb 22, 2020

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!

<br>
~ David Sweeney-Bear ~
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2020 Feb 23, 2020

Use this:

 

var numWords = this.getPageNumWords(this.pageNum);
app.alert("There are " + numWords + " words in this page.", 3);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 23, 2020 Feb 23, 2020

thanks so much... works like a charm 🙂

<br>
~ David Sweeney-Bear ~
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2020 Feb 23, 2020

My free abracadabraTools adds a Word Counter item in Acrobat's Edit menu:

https://www.abracadabrapdf.net/utilitaires/utilities-in-english/abracadabratools_en/

 

Annotation 2020-02-23 100028.png


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 23, 2020 Feb 23, 2020
LATEST

sorry, but the document word count returns "0" and the page word count does nothing.

<br>
~ David Sweeney-Bear ~
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines