Is there any command-line utility to find the number of words in a PDF?

I will use the number of words in a pdf to estimate the time I'll spent reading it. I can get the number of pages of a PDF with qpdf, but the number of pages is a bad estimate to the time required to read a book, since a page can contain few or lots of text.

A worst case scenario to achieve my goal would be converting PDFs to plain text using pandoc (or pdftotext), then using wc to count the number of words and characters. But that is bad: it will take time to convert the pdf to text, them create useless large text files just to calculate the number of words. Since PDFs can contain hundreds of pages, this solution is not efficient.

  • 1
    If there is no (standard) place in the PDF to store word and character counts (AFAIK there is only a page count there), any tool would need to convert the PDF anyway, and your "worst case scenari" would become "the only scenario".
    – d.c.
    May 3 at 20:59
  • Some PDF files contain pictures of text. I received a 15,001 page .pdf from the government (Access to Information response) with nothing but pictures of text. Also, word count is not a good predictor of reading speed. Density of ideas, how hard it is for you to understand them, ....
    – waltinator
    May 3 at 22:57
  • @d.c that makes sense May 4 at 0:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.