Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I get the word count of a PDF file?

share|improve this question
add comment

5 Answers 5

up vote 22 down vote accepted

If on Unix, you can use pdftotext:

and then do the word count in the generated file. If on Unix, you can use:

wc -w converted-pdf.txt

to get the word count.

Also, see the comment by frabjous - basically, you can do it in one step by piping to stdout instead to a temporary file:

pdftotext myfile.pdf - | wc -w
share|improve this answer
3  
It's pdftotext : don't forget the e. And you can use a single command: pdftotext myfile.pdf - | wc -w. –  frabjous Dec 13 '10 at 4:15
    
@frabjous Thanks, updated the answer with the suggestions! –  icyrock.com Dec 14 '10 at 1:48
add comment

I just tried out a free program, Translator's Abacus. You can drag and drop various file types (including PDF), and it pops up a browser with a printable report of the word count for each document. It worked fine for me. (It is specifically created for word counts and is only 435 KB... that is, not a "big application"). Translator's Abacus doesn't work on PDF 1.5 or later.

Alternatively: you can just Ctrl+A to select all text in Acrobat Reader and then copy-paste it into a program like Microsoft Word (which has a word count on the status bar at the bottom of the screen).

share|improve this answer
    
Thanks. That's what I was looking for. –  RoflcoptrException Apr 7 '11 at 7:38
    
In (many?) PDFs, Crl+A only selects the words on the current page, not the entire document. The Translator's Abacus works perfectly though, great! –  Junuxx Oct 8 '12 at 12:44
1  
Correction, Translator's Abacus doesn't work on PDF 1.5 or later. –  Junuxx Oct 8 '12 at 12:55
    
+1 Ctrl+A in Adobe Reader together with WinMerge work great in Windows! –  superjos Mar 4 '13 at 10:43
add comment

This is a hard task not not easy to solve. If you really want an exact result, copy paragraph by paragraph for your PDF viewer into a text file and check it with the wc -w tool. The reason why not to use pdftotext in that case is: mathematical formulas may get also into the output and regarded as "words". (Alternatively you could edit the output you get from pdftotext). Another reason why this may fail are the headings: "4.3.2 Foo Bar" is counted as three words.

A way around is only to count words starting with a char out of [A-Za-z]. So what I usally do is a two step approach:

  1. get the list of uniq words and check if there are too much false positives inside:

    pdftotext foo.pdf - | tr " " "\n" | sort | uniq | grep "^[A-Za-z]" > words

    I don't use a dictionary here, as some spelling errors would not count as words.

  2. Get this word list and grep it within the output of pdftotext:

    pdftotext foo.pdf - | tr " " "\n" | grep -f words | wc -l

I know this could be done within a one liner, but then I could not easily see the filter result from the first step.

share|improve this answer
add comment

I find the word counter included in abracadabra tools convenient. The installation is a bit quirky though.

share|improve this answer
add comment

Ctrl+Shift+F enter advanced search type the word and it will count how many times it is in the doc. It is not rocket science.

share|improve this answer
3  
I think you've misunderstood the question... 'word count' normally refers to the total number of words in a document, rather than the number of a specific word... and also, I think it would be better if you were to specify which program you are talking about - not all PDF readers have the same functions or use the same keyboard shortcuts. –  evilsoup Mar 28 '13 at 19:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.