IronFlowDocs

extract_pdf

Extract text and metadata from a PDF document.

Parameters

pathstringone of path or source_key
File path to the PDF; supports ${ctx.key} interpolation.
source_keystringone of path or source_key
Context key whose value is the file path (must be a string).
formatstringdefault "text"
Output format: "text" for raw extracted text, "markdown" for best-effort paragraph-grouped Markdown.
output_keystringdefault "content"
Context key where the extracted text is stored.
metadata_keystring
If set, PDF metadata is stored under this context key.

Providing both path and source_key is an error. The format parameter only accepts "text" or "markdown"; any other value is rejected.

Context Output

  • <output_key> (default content) — the extracted text or Markdown.
  • <metadata_key> (only when metadata_key is set) — an object with available fields: pages (number), title, author, subject, keywords, creator, producer, created, modified.

Example

local flow = Flow.new("read_pdf")

flow:step("extract", nodes.extract_pdf({
    path = "${ctx.file_path}",
    format = "text",
    output_key = "pdf_text",
    metadata_key = "pdf_meta"
}))

flow:step("done", nodes.log({
    message = "Pages: ${ctx.pdf_meta.pages}, Content: ${ctx.pdf_text}"
})):depends_on("extract")

return flow

IronFlow documentation

Find the next step

Type a keyword to search the documentation.

to move · Enter to open · Esc to close