Download icon
Parse icon
Log icon

Download a PDF file and extract text from it using Apache Tika

Download any PDF over HTTP and extract clean, machine-readable text with Apache Tika in Kestra. A ready-to-run document parsing pipeline.

Categories
Core
id: parse-pdf
namespace: company.team

tasks:
  - id: download_pdf
    type: io.kestra.plugin.core.http.Download
    uri: https://huggingface.co/datasets/kestra/datasets/resolve/main/pdf/app_store.pdf

  - id: parse_text
    type: io.kestra.plugin.tika.Parse
    from: "{{ outputs.download_pdf.uri }}"
    contentType: TEXT
    store: false

  - id: log_extracted_text
    type: io.kestra.plugin.core.log.Log
    message: "{{ outputs.parse_text.result.content }}"

Turn unstructured PDF documents into clean, machine-readable text without writing custom extraction code. This blueprint fetches a PDF file over HTTP and runs it through Apache Tika to pull out its text content, giving you a reusable building block for document processing, search indexing, RAG ingestion, and downstream analytics pipelines.

How it works

The flow runs three tasks in sequence:

  1. download_pdf uses io.kestra.plugin.core.http.Download to fetch a PDF from a remote uri (the sample points at a public Hugging Face dataset) and stores it in Kestra internal storage.
  2. parse_text uses io.kestra.plugin.tika.Parse to read the downloaded file, with contentType: TEXT to return plain text and store: false to keep the extracted content inline in the task output.
  3. log_extracted_text uses io.kestra.plugin.core.log.Log to print the parsed text from parse_text.result.content, so you can confirm the extraction worked before wiring up real consumers.

What you get

  • A working PDF-to-text extraction pipeline you can run as-is.
  • Clean text output exposed at {{ outputs.parse_text.result.content }} for downstream tasks.
  • A pattern that swaps cleanly between remote and internal-storage PDF sources.
  • A foundation for document search, summarization, and AI ingestion workflows.

Who it's for

  • Data engineers building document ingestion and ETL pipelines.
  • ML and AI teams preparing PDF corpora for RAG or embedding pipelines.
  • Analysts who need to mine text out of reports, invoices, or contracts.

Why orchestrate this with Kestra

Apache Tika is a parsing library, not a scheduler. Kestra wraps it in a declarative YAML workflow so the same extraction can run on a schedule, react to event triggers (such as a new file landing in object storage), retry automatically on transient HTTP failures, and feed its output into other tasks. You get full execution lineage, logs, and replay for every document processed, plus the ability to fan out across many files, all things a standalone library call cannot provide.

Prerequisites

  • A running Kestra instance.
  • Network access to the PDF source URL.

Secrets

This blueprint downloads a public PDF and uses no secrets. If you point it at a protected source, add credentials with {{ secret('NAME') }} and reference them in the download_pdf task headers.

Quick start

  1. Add the flow to your Kestra instance.
  2. Execute it as-is to extract text from the sample PDF.
  3. Inspect the log_extracted_text task output to see the extracted content.
  4. Change the uri in download_pdf to point at your own PDF.

How to extend

  • Replace the Log task with a write to a database, data warehouse, or vector store.
  • Switch contentType to XHTML or JSON to preserve structure and metadata.
  • Add a Schedule or file-detection trigger to process documents automatically.
  • Loop over a list of PDF URLs to batch-process an entire document set.

Links

Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.