
Apache PDFBox Extract
CertifiedExtract text from a PDF
Apache PDFBox Extract
Extract text from a PDF
Reads the text layer of a PDF from internal storage, for the whole document or a page range. Scanned PDFs without a text layer return empty text; render their pages with image.Render and run OCR instead.
type: io.kestra.plugin.pdfbox.text.ExtractExamples
Extract the text of the first five pages of an uploaded PDF
id: pdf_extract_text
namespace: company.team
inputs:
- id: file
type: FILE
tasks:
- id: extract
type: io.kestra.plugin.pdfbox.text.Extract
from: "{{ inputs.file }}"
startPage: 1
endPage: 5
- id: log_text
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.extract.text }}"
Extract text page by page from an encrypted PDF and store it in internal storage
id: pdf_extract_pages
namespace: company.team
inputs:
- id: file
type: FILE
tasks:
- id: extract
type: io.kestra.plugin.pdfbox.text.Extract
from: "{{ inputs.file }}"
password: "{{ secret('PDF_PASSWORD') }}"
perPage: true
fetchType: STORE
Properties
from *string
The PDF to read, as an internal storage URI
Pebble expression referencing an Internal Storage URI e.g. {{ outputs.mytask.uri }}.
assets
Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset failure behavior
Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
io.kestra.plugin.ee.assets.Dataset
1150{}1150io.kestra.plugin.ee.assets.File
1150{}1150io.kestra.plugin.ee.assets.Table
1150{}1150io.kestra.plugin.ee.assets.VM
1150{}1150io.kestra.core.models.assets.External
1150{}1150io.kestra.core.models.assets.Custom
11501Custom asset type
{}1150endPage integerstring
Last page to read, inclusive
Defaults to the last page.
fetchType string
FETCHSTOREFETCHFETCH_ONENONEHow to return the text
FETCH (default) returns it in text and pages. STORE writes UTF-8 text files to internal storage and returns uri and pageUris; use it for long documents, since task outputs are limited in size. NONE returns only pageCount. FETCH_ONE is not supported.
maxPages integerstring
1000Maximum number of pages to read
The task fails instead of reading more pages than this; narrow the page range for longer documents. Default 1,000, between 1 and 100,000.
password string
Password of an encrypted PDF
perPage booleanstring
falseAlso return the text of each page separately
When true, pages (or pageUris with fetchType: STORE) holds one entry per page in the range, in order. Default false.
sortByPosition booleanstring
falseSort text by its position on the page
Helps with multi-column layouts and PDFs whose text is written out of reading order. Default false.
startPage integerstring
1First page to read, starting at 1
Default 1.
Outputs
pageCount integer
Total number of pages in the document
pageUris array
Internal storage URIs of each page's text file, when perPage is true and fetchType is STORE
pages array
Text of each selected page, when perPage is true and fetchType is FETCH
text string
Text of the selected pages, with fetchType: FETCH
uri string
uriInternal storage URI of the text file, with fetchType: STORE