Copy link to clipboard
Copied
How do I count words in an English PDF document?
Copy link to clipboard
Copied
HOW does one run a WORD COUNT in Acrobat?
Like you, I'm dealing with novel manuscripts -- 50,000 to more than 100,000 words.
Thank you.
Copy link to clipboard
Copied
Read the thread. Multiple answers were provided to this question.
Copy link to clipboard
Copied
Or, you could copy/paste into a Word document and do the word count there.
Copy link to clipboard
Copied
You can also create an Action Wizard with Dave's script and by changing "console.printIn" to "app.alert" a dialog box will pop up with the page count.
Copy link to clipboard
Copied
Actions are not available in Reader, only in Acrobat Pro.
And using an alert in an Action is counter-productive as it means you have to sit in front of it, clicking OK, OK, OK...
It's better to print out the result to the console, preceded by the name of the file that's being processed.
Then when the process is done you open the console and see all the results in one glance.
Copy link to clipboard
Copied
On Windows platform you can use AnyCount Word Count and Character Count Software
It supports word count in 38 formats including PDF. Actually, it can count even on PC without Adobe Acrobat installed.
Copy link to clipboard
Copied
I have used the below JavaScript, and it works well. But does anyone know, if it is possible to make a JavaScript that instead of counting words, counts characters including spaces?
var cnt=0;
for (var p = 0; p < this.numPages; p++) cnt += getPageNumWords(p);
console.println("There are " + cnt + " words in this file.");
Copy link to clipboard
Copied
You could write a script that looped through the words, got the number of characters in each one, and added together. You can't get spaces or punctuation, the spaces often aren't even there (just gaps). You could add 1 for each word, which would be approximate but not (for example) a solid basis for payment.
Copy link to clipboard
Copied
Actually, you can get spaces and punctuation by setting the third parameter (bStrip) of getPageNthWord as false.
This code will count all the characters in a document:
var charCount = 0;
for (var p=0; p<this.numPages; p++) {
var numWords = this.getPageNumWords(p);
for (var i=0; i<numWords; i++) {
var word = this.getPageNthWord(p,i,false);
charCount+=word.length;
}
}
app.alert("There are " + charCount + " characters in this file.",3);
Copy link to clipboard
Copied
Thanks try67. I just got one question. When I test your code, in a single PDF page, it says there is 1608 characters, but if i export the same PDF page into word, word says there are 1568 characters. Any idea why those two are different?
Copy link to clipboard
Copied
Not really, sorry. There could be all kinds of issues related to how some characters like spaces, line-breaks, tabs, etc. are counted. Don't expect to get exactly the same results in both applications.
Copy link to clipboard
Copied
Love this - but anyone know how to tweak the JS to count a specific page/page range? Thanks
Copy link to clipboard
Copied
Let's say you want to count from page 3 to page 10.
Change this part of the code:
for (var p = 0; p < this.numPages; p++)
To this:
for (var p = 2; p<=9; p++)
(notice the page numbers are 0-based...)
Copy link to clipboard
Copied
Awesome! Thanks so much for the super speedy reply
Copy link to clipboard
Copied
Hi Dynamedix,
There are many software or online word counter tools are available on the Google to count the words. It's the really the very tough task if you count one by one. To count the word with in the PDF file
Otherwise try other online word count tool by uploading file or extracting the text.
Copy link to clipboard
Copied
Hi,
++Adding to this old thread, here's an workaround observation that turned out to work for me in both Acrobat Reader DC and partially in Adobe Reader mobile app, and a third party mobile PDF viewer.
Adobe Acrobat Reader mobile app doesn't have word count and neither does Acrobat Reader DC.
However, the following method proved to be useful:
See slides below.
With your main document opened select combine files and add the PDF with the button script that I've shared above
Select Combine to merge both PDFs.
Below, selecting Organize Pages tool to see the final result of the merged documents :
NOTE: Be advised that the wordcount script might not be entirely accurate since the total word count seems to vary from app to app.
For example, in Adobe Reader DC the script will count all of the form field objects (like text form fields, drop down menus, and even the event button objects with a label) even if they're blank, and then include in the word count total all of these form field object plus the real count of the text words that were found throughout the PDF.
Curiously enough, in a third-party appp like Foxit, it is able to count the exact words that are in the PDF.
For some reason I haven't been able to have the script to work in Adobe Reader mobile app, but the Adobe Reader app does allow me to merge two or more documents with the PDF that has the script.
On the other hand, the third party mobile app doesn't provides me with a merging capability (that I know of) but the script executed and worked fine in this third party app after it was merged with the Adobe Adobe Reader mobile app.
Here is the script originally posted by Dave Merchant:
var cnt=0;
for (var p = 0; p < this.numPages; p++) cnt += getPageNumWords(p);
app.alert("There are " + cnt + " words in this file.");
See slide below using third party app:
Copy link to clipboard
Copied
This won't work in Reader DC, since it can't merge PDF files.
Copy link to clipboard
Copied
Correct, but with the Reader mobile app (at least with AndroidOS) allows to merge using the Organize Pages tool.
The user will need a paid subscription with Acrobat Pro DC of course.
Then upload the PDF back to the cloud back to a PC with Reader.
I know... is completely unorthodox, but just food for thought for those great developers out there such as yourself.
Copy link to clipboard
Copied
If you want to do it in Reader you can use this free tool I've developed. Once installed it takes a single click to run it: http://try67.blogspot.com/2015/01/reader-word-count-free.html
Copy link to clipboard
Copied
Hey, thank you so much as usual for sharing this!
Copy link to clipboard
Copied
sumon gazi
Copy link to clipboard
Copied