Many times I wanted to count the number of words in a PDF document. The normal way to do this task is to save the file as a Word doc and then open it in MS Word that calculates the count. You can also upload your file to an online site that will count it (although most companies would probably frown upon sending your precious data to some random 3rd party site).
Today I stumbled across an Adobe forum thread that said that Acrobat can run JavaScript. Hmmm... And then I found another site that explains how to create a custom tool in Acrobat. Put these two together and you get a toolbar button in Adobe Acrobat to count the number of words in the doc.
Here's how to make it work. Note that this is for Acrobat DC.
- Open Acrobat.
- Click Tools.
- Click Action Wizard.
- In the button list under the toolbar, click New Custom Command.
This window opens:
- Click Execute JavaScript.
- Change the Label to something useful, like "Count words in document".
- Change the Tool tip to something useful, like "Counts the number of words in the current document".
- Click Command Options...
- Paste in the following code:
/* Count number of words in document */
var cnt = 0;
for (var p = 0; p < this.numPages; p++) cnt += getPageNumWords(p);
app.alert("There are " + cnt + " words in this file.");
- Click OK.
- Click Don't show options, options are always the same.
- Click OK.
- Right-click in a blank part of the toolbar.
- Click Customize Quick Tools.
- Expand the Action Wizard section.
- Find your new command and select it.
- Click the Add to Toolbar button on the right side of the window.
- Click Save.
Not bad, but if you just want a subsection of the document, word really shines. But thanks for trying. Now I have to extract the pages I want to check and then run the counter. Similar hassle.
ReplyDeleteWord is easily better than Acrobat at counting words. But, the issue that I regularly have is to find out how many words are in a PDF, such as for submitting a document for translation when I don't have any other source (like Word). I can't recall ever having to count words in a section of a doc.
ReplyDeleteI took a quick look and there doesn't seem to be a way to grab a selection using JavaScript in a PDF doc :( If you find one, let me know and I'll update the post.
amazing!
ReplyDeleteThank you! Works perfectly :-) Tommy of Finland
ReplyDeleteGreat blog. All posts have something to learn. Your work is very good and i appreciate you and hopping for some more informative posts.
ReplyDeleteWord Counter
Blogger’s brilliant Efforts are really appreciable keep sharing word count tool
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThanks for sharing this news ! Nice Blog It is full of creative information.
ReplyDeleteWord Count Software
Delete/* Count number of words in document */
var cnt = 0;
for (var p = 0; p < this.numPages; p++) cnt += getPageNumWords(p);
app.alert("There are " + cnt + " words in this file.");
ReferenceError: cnt is not defined
1:Console:Exec
undefined
-------------------
Please help!
Hi. At my current job I don't have Adobe Acrobat, so I don't have any way to check if it still works. Sorry!
DeleteFantastic blog! Do you have any tips and hints for aspiring writers? I’m planning to start my own website soon but I’m a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many options out there that I’m completely overwhelmed .. Any suggestions? Many thanks! read
ReplyDeleteThanks for the feedback. As for tips... it depends what type of writing you want to do. I am a technical writer, so I need to know about technology, tools, and writing in a style that conveys information succinctly and accurately.
DeleteTry and find Slack channels (such as Docs as Code). And remember to keep learning, whether you learn about new technology or learn about new tools, just keep learning.