Convert Portable Document Files (pdf) Into Plain Text Files From Commandline

This short tutorial will explain you how to convert pdf documents into plain text files with the pdftotext commandline utility. The pdftotext utility reads a pdf file and takes it as an input for creating a text file. You can convert the all pdf document or use specific options to select only the pages you want to convert.

What about encrypted and password protected pdf documents, can I convert them to text file? Of course that you can, the '-upw' option is used to take the document's password as an argument and then the pdftotext utility can convert the pdf document to text file.

How to install the pdftotext utility in Debian/Ubuntu?

Open a new terminal (CTRL+ALT +T) and type the following command to install the pdftotext utility in Debian/Ubuntu linux machines.

sudo apt-get install poppler-utils

Install pdftotext in RedHat, RHEL, Fedora, CentOS Linux.

yum install poppler-utils

Learn To Use The pdftotext Utility

I have a pdf document in my test directory which is in the machine Desktop like shown in Figure 1.

Figure 1

The following command is used to convert the pdf file into a text file.

pdftotext 31pdftotext 31dbbb-final.pdf 31.txt

Figure 2

The result of the above command is shown in Figure 3.

Figure 3

About Oltjano Terpollari

Oltjano Terpollari is a very passionate computer geek studying python, linux, netcat power tools and living a binary life. He goes by the nickname Ambition and is very happy living a science life. He also loves technical blogging and sharing his knowledge with others.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.