BLOG
10 November 2022

Convert PDF to TXT with pdftotext (poppler-utils)

TTTThis
  1. sudo apt install poppler-utils
  2. open Terminal in folder
  3. pdftotext -layout pdfname.pdf documenttocreate.txt
    (where -layout tries to preserve the formatting of the pdf, it is an optional command)
  4. pdftotext -layout -f 1 -l 20 pdfname.pdf documenttocreate.txt
    (where f and l designate the first and last pages, we create a txt file out of pages 1-20 of the pdf)

Pdf To Text doesn't support batch conversion. You have to do it using “Bash for loop” to convert a whole folder full of pdfs.

for file in *.pdf; do pdftotext -layout "$file"; done

To convert all pdfs in that folder to files (I haven't tested this)

NewerConvert image to text (tesseract-ocr) OlderConvert PDF all pages (or some) into images (pdftoppm)