How to create a text file from a given PDF File on Ubuntu via terminal

Sometimes one needs the plain text of a given PDF file. For this you can use pdftotext this program is part of the poppler utils.

Open your terminal ctrl+alt+t

Navigate to your files location

then 1st install the poppler-utils

sudo apt update && sudo apt install -y poppler-utils

After the installation, you can run this command

pdftotext example.pdf example.txt

You can also use “-layout” option to retain the layout of the text in the output file as it is in the input PDF file.

pdftotext -layout example.pdf example.txt

That's it :D