Showing posts with label adobe. Show all posts
Showing posts with label adobe. Show all posts

Wednesday, August 24, 2016

Count the Number of Words using JavaScript in Adobe Acrobat

This is the best hack that I've come across in the last several years.

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.
  1. Open Acrobat.
  2. Click Tools.
  3. Click Action Wizard.
  4. In the button list under the toolbar, click New Custom Command.
    This window opens:

  5. Click Execute JavaScript.
  6. Change the Label to something useful, like "Count words in document".
  7. Change the Tool tip to something useful, like "Counts the number of words in the current document".
  8. Click Command Options...
  9. 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.");
  10. Click OK.
  11. Click Don't show options, options are always the same.
  12. Click OK.
You now have a custom command. All that's left to do is make the button that calls it.
  1. Right-click in a blank part of the toolbar.
  2. Click Customize Quick Tools.
  3. Expand the Action Wizard section.
  4. Find your new command and select it.
  5. Click the Add to Toolbar button on the right side of the window.
  6. Click Save.
That's it! You can now open any PDF and just click the button to get a word count.

[Source: KHKonsulting and Adobe]

Sunday, November 18, 2012

Printing Comments for Adobe PDFs

For those of you who have Adobe Acrobat X, there is a nice way to create a PDF showing all of the comments in the document. The result uses a landscape orientation with the original page on the left side and a list of the comments on the right side. It also has arrows that connect the comments to the text in the original document.

How to create a document showing all comments:
  1. Click Comment on the top-right.
  2. If the comment list is not open, then click Comments List.
  3. On the top-right of the Comments List pane, select Options --> Create Comment Summary.
  4. In the window that opens, select the radio button next to Document and comments with connector lines on single pages.
  5. Click Creat Comment Summary.
  6. This creates a new PDF document that shows the comments.
  7. Save the document.
[Source Adobe]