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

How do I get a word count for a PDF doc or for a selected passage?

Community Beginner ,
May 01, 2015 May 01, 2015

Copy link to clipboard

Copied

How do I get a word count for a PDF doc or for a selected passage?

TOPICS
Create PDFs , How to

Views

128.9K

Translate

Translate

Report

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 ,
Dec 15, 2017 Dec 15, 2017

Copy link to clipboard

Copied

You need to create a custom Keystroke script, as that's the only one that is executed each time you type something into the field.

If you're interested I've already developed a tool that does just that: Custom-made Adobe Scripts: Acrobat -- "Live" Characters and Words Counter

Votes

Translate

Translate

Report

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 ,
Dec 15, 2017 Dec 15, 2017

Copy link to clipboard

Copied

You'll find scripts for counting words, letters, etc. here:

Calculating field values and more

As Try says, you'll need to use a custom keystroke event. This is tricky because event.value does not include the newly typed text, so you'll need to combine both event.value and event.change.

Here's how:

if(!event.willCommit)

{

  var nChars = event.selEnd - event.selStart;

  var aFull = event.value.split("");

  aFull.splice(event.selStart, nChars, event.change);

  var strFull = aFull.join("");

  var aWrds = strFull.split(/\s+/);

  ... rest of code ...

}

Using the regEx for the split catches multiple spaces, tabs, and line feeds

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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 ,
Sep 16, 2022 Sep 16, 2022

Copy link to clipboard

Copied

"Word counter" is one of my free plugins for Acrobat:

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

Votes

Translate

Translate

Report

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