Showing posts with label Words count. Show all posts
Showing posts with label Words count. Show all posts

Words count for PDF file in 3 steps

This article will show you how to count words in a .PDF file using Javascript console in Adobe Acrobat. If you are not familiar with Javascript console in Acrobat, you can read more in here but in general, you do not need to know too much about it. The following instruction is very easy to follow.

Step 1: Start Javascript console by pressing Ctrl + J (on Windows) or Command + J (on Mac OS)
Then you will have Javascript Debugger windows opened.

Step 2: In the text box below View:Console
You type in (or copy, paste) the following codes

var cnt=0;
for (var p = 0; p < this.numPages; p++) cnt += getPageNumWords(p);
app.alert("There are " + cnt + " words in this file.");

Step 3: Select all the code (the above 3 lines), press Control + Enter (or Command + Enter on Mac OS). If you have a numpad, press Enter there

Then you will have a alert windows tells you how many words in your documents.

Have fun.
Lam Hoang

The Acrobat JavaScript Console

The Acrobat JavaScript Console (Your best friend for developing Acrobat JavaScript) By Thom Parker, Software Developer/Adventurer, WindJack Solutions, Inc.
The Acrobat JavaScript Console Window (a.k.a. the Console Window) is one of the many tools included in the Acrobat JavaScript Debugger Dialog (Figure 3). The Console Window is the best of the bunch. The other tools are very useful and have much better performance and stability in Acrobat XI than in previous versions. However, the Console Window remains many times faster and easier to use than the other tools, as well as being error free.
The Console Window is a multi-purpose and somewhat generic tool. It is the default location where JavaScript error messages are displayed as well as being an entry window for testing and debugging Acrobat JavaScript code. It can also be used to execute code snippets to automate tasks in Acrobat and to analyze documents. It does not do everything needed to debug code, but it does provide a quick and easy way to perform most of the code development tasks you'll ever need to do. In this article, we'll cover setting up and using this essential tool.
Note: Special instructions for using the Console Window with Reader are provided at the end of the article.

Setting up the Console Window in Acrobat XI

If this is your first time using the Console Window, you will need to enable and configure it from Acrobat's Preferences settings. Depending on your platform, use one of the following methods to open the Preferences dialog (Figure 1).
Acrobat Preferences
PlatformShortcutAcrobat Menu Item (Acrobat 6.0 and above)
WindowsCtrl + KEdit > Preferences
MacintoshCommand + KAcrobat > Preferences (On Application menu)
In Preferences, select the JavaScript panel. Make sure both Enable Acrobat JavaScript and Enable interactive console are checked. These are the two most important preference settings. In fact, both of these settings may already be checked. JavaScript is turned on by default, and Acrobat will automatically ask you if you want to turn on the Console Window if you attempt to use it.