Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
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

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

TOPICS
Create PDFs , How to
149.9K
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 ,
Dec 15, 2017 Dec 15, 2017

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

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

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

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

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

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


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
Community Beginner ,
Nov 28, 2024 Nov 28, 2024
LATEST

If you're looking for an easy and efficient way to count words, I recommend trying this pdf word counter. It’s a user-friendly tool that helps you track word counts in PDFs and other documents, making it a great option for anyone needing an accurate word count quickly. Check it out for a seamless word-counting experience!

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