Skip to main content

Extract text

Extract the text of a PDF, of a page range or of chosen pages, as plain or layout-ordered text, optionally into a .txt file. Scanned PDFs (images) need OCR instead.

Command in the PDF toolkit · id ooa.pdf/extract_text · 8 inputs (1 required), 2 outputs

Inputs​

InputTypeRequiredDefaultWhat it is
PathFileYesPDF file.
From pageNumberNo1First page (1-based).
To pageNumberNoLast page; the end when empty.
PasswordCredentialNoPassword for protected PDFs.
ModeStringNostructuredstructured orders text by its position on the page, keeping columns and tables readable; plain keeps the order stored in the file, like copy and paste.
PagesStringNoExact pages to read, e.g. 1,3,5-7, in that order; overrides from_page and to_page.
Output fileFileNoAlso write the text to this .txt file (UTF-8).
OverwriteBooleanNotrueReplace output_file when it already exists; false stops with PDF.EXISTS.

Outputs​

OutputTypeWhat it is
textStringExtracted text.
page_countNumberTotal pages in the document.