Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Is there any way I can get the word count of a PDF document that I'm viewing in Evince, Ubuntu's default pdf viewer? I'm able to convert the documents to text files and get the word count from the terminal, but I'd quite like to be able to quickly get at them without having to use the terminal. Is there any plugin that can do this, or is it already built in and I'm just missing it?

P.S. I'd prefer not to change my viewer as Evince is the default PDF viewer in Ubuntu, and I'd quite like to do as much as possible using the default applications since a lot of them, Evince included, are really nice.

share|improve this question

5 Answers 5

You can do this via command line:

pdftotext filename.pdf - | tr -d '.' | wc -w
share|improve this answer
Thanks, but as I said in the question, I'd rather not have to use the command line for this sort of thing. – Chris Wilson Nov 8 '10 at 19:24
@Chris Try to integrate system("<command above>") in the evince code then. – Gödel Nov 8 '10 at 19:57

How about a quick bash script requiring zenity and evince. When called without an argument, it'll give you a dialogue box so you can choose a file. When called with an argument (or after said dialogue box), it'll both open the file in evince and give you a dialogue box with a word count.

In other words, copy the following into a text file, called or something, save it somewhere in your path (e.g., ~/bin/), make it executable (either through Nautilus's right click and properties or with chmod +x ~/bin/,

if [ "$#" -gt "0" ] ; then
    filename="$(zenity --file-selection)"
evince "$filename" &
zenity --info --text "This PDF has $(pdftotext "$filename" - | tr -d '.' | wc -w) words"
exit 0

Now, right click on some on some PDF in nautilus, choose "Open with..." and then have it open with Now, when you open a PDF, it'll both open in evince, and give you a word count.

alt text

share|improve this answer
You could put this file in /home/$USER/.local/share/nautilus/scripts/ which makes it available from right-click in Nautilus (Ubuntu vanilla file mananger). – Daniel Holm May 2 '14 at 12:23
up vote 7 down vote accepted

A response from Olaf Leidinger on the Evince mailing list:

I think such a feature is better suited for document editors, as they have more information on the document as a plain viewer and counting words is trivial. Take a PDF file as an example. What you see as text might actually be some kind of vector graphic shape. Even if the text is contained as such in the PDF file, those words you see might be composed of multiple "draw text at position (y,x)"-commands -- e.g. in case of umlauts or end of line. So a single word might count as multiple words. Therefore I think it might be hard to implement such a feature reliably. Have a look at pdftotext to see what I mean.
share|improve this answer
Whatever file is used to define the document could be considered "source code", and Evince is the machine that executes the code. It's unfair (and impossible) to ask the source code editor (e.g. a text editor) to determine what the output of the execution will be, so let's just look at the output (i.e. the rendered image/text in Evince/poppler). Implementation in Evince would be useful to me since I'm "coding" my papers in a language-agnostic text editor and use Evince (via Pandoc and pdflatex) to "run" my source. Only at the end can we be certain what made it through. Consider commented code. – user29020 Oct 23 '14 at 0:43

I don't believe that is possible (well it's technically possible but hasn't been implemented).

You have to remember Evince is a document viewer and a word count is a feature more usually required in an editor (yes I know this isn't always the case).

You might like to contact the Evince developers and ask if they would have any interest in implementing this feature.

share|improve this answer
Thanks. I've contacted them and I'll keep the question open until I get a definitive response. – Chris Wilson Nov 8 '10 at 19:25
When you hear back, feel free to effectively answer your own question :) – 8128 Nov 8 '10 at 19:32
Evince is not strictly a "viewer". Creating and viewing and editing a document is clearly a bigger workflow than just "edit" and then "view". Regarding the question: Evince currently allows copying select text. That's not strictly a "view" role. Evince is in a great position to find out resulting word count since it's the final "renderer" of what we actually read (or send to publisher). It already has a way to identify rendered whole words (try double-clicking a word!). I'd love Evince to provide this in the "File->Properties" box. It already tells me the page count (based on rendering). – user29020 Oct 22 '14 at 21:51

As far as I know you can't, but that would be a very good addition if you ask me.

share|improve this answer

Your Answer


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.