Utilities
Extract plain text from one PDF file
Plain text from one PDF. Distribute the node to convert many.
overview
What pdftotext does
You have a PDF, and the next node needs the words as text. Connect the file to input. The wrapper checks the %PDF- magic, calls Poppler pdftotext, and writes the text to the output path. Non-PDF files become an empty output and a skip line on stderr so a distributed folder does not fail the whole batch.
-f and -l bound the first and last page. -layout is a boolean that keeps physical columns; leave it disconnected unless you want that flag. Hive file output is the text file itself, not a folder of pages.
pdftotext reads text objects already in the PDF. It does not OCR a scan. Use tesseract when the page is an image. Distribute the node over a folder of PDFs when you have many files.
use cases
Where pdftotext fits
Extract one PDF
Connect the PDF to input. The output file is the extracted text.
Limit to a page range
Set -f and -l. Useful when only the first pages matter.
Keep column layout
Connect -layout only when you want physical positions preserved.
Convert many PDFs
Distribute the node. Non-PDF shards write an empty file and skip.
reference
pdftotext inputs and flags
| Name | Type | Flag | Description |
|---|---|---|---|
| input | FILE | · | Input PDF file. |
| first-page | STRING | -f | First page to convert. |
| last-page | STRING | -l | Last page to convert. |
| layout | BOOLEAN | -layout | Preserve the physical layout of the text. |
Showing key inputs. pdftotext exposes 4 inputs in total.
example
Run pdftotext
pdftotext hello.pdf /hive/out/hello.txtHello smokeguidance
Choosing pdftotext
Use pdftotext when the PDF already has a text layer. Use tesseract when the page is a scan or an image.
tesseract
OCR for images and scanned pages. Use it when pdftotext writes almost nothing.
trafilatura
Extracts article text from HTML, not PDF.
wget
Downloads a PDF. It does not extract text.
faq
pdftotext questions
related
More Utilities tools
browser-fetch
Headless Chromium render: requested URL, final URL, status, and title next to the page.
cewl
Spider a URL and return a wordlist for password crackers.
csvkit
SQL on one CSV. The table name is the file stem.
dnsgen
Wordlist and mined-word subdomain permutation.
duckdb
In-process SQL on CSV, JSON, and Parquet. No server.
edge-tts
Microsoft Edge neural speech from text or a script file. No API key.
Run pdftotext yourself
A fixture PDF feeds pdftotext. The text below is from a completed run.
Facts on this page come from the live Trickest tool library.