@zack/pdf-to-text

Extract text from PDFs, either from a URL or base64-encoded PDF data.

ToolSignedStandardLegacy · undeclaredNo license declaredpython 3.11
Z
@zack
Publication time unavailable4 installs · all versions

Get started

Install, run, or load this Tool.

Run directly with the CLI or call from an SDK

01Install

Resolve this exact Tool version and its prepared dependencies.

agentpm install @zack/pdf-to-text@0.1.2

02Run Tool

Send JSON to its declared input contract and receive JSON output.

agentpm run @zack/pdf-to-text@0.1.2 --input-file input.json

Supply input.json matching this Tool’s input schema.

ORLoad via SDK

Call the installed Tool through an SDK.

import { load } from '@agentpm/sdk';
const t = await load('@zack/pdf-to-text@0.1.2');
CLI version & updates

CLI 0.1.36+ reads and preserves standard declarations. New publications require an explicit supported standard; use the latest CLI for current authoring checks. Historical releases remain installable as published. This floor does not establish selected-release installation support or Harness readiness.

Check agentpm --version, then follow the CLI installation and update guide. See the publication compatibility requirements.

Interface

The contract a caller must satisfy, from the authored JSON Schema.

Input

Exactly one of pdf_url or pdf_base64 must be provided. This is enforced at runtime.

pdf_urlstringoptional

HTTP(S) URL of the PDF to download and extract text from.

format:
"uri"
split_bystringoptional

How to split the extracted text. 'page' returns per-page text; 'chunk' additionally returns contiguous text chunks.

enum:
["page","chunk"]
default:
"page"
max_pagesintegeroptional

Maximum number of pages to process, starting from page 1.

minimum:
1
pdf_base64stringoptional

Base64-encoded PDF bytes. Use this when you already have the PDF contents.

user_agentstringoptional

Optional User-Agent header when fetching pdf_url. Overrides default and any environment value.

strip_whitespacebooleanoptional

If true, collapse excessive whitespace/newlines in extracted text.

default:
true

No other input fields are accepted.

Complete input schema
{
  "type": "object",
  "required": [],
  "properties": {
    "pdf_url": {
      "type": "string",
      "format": "uri",
      "description": "HTTP(S) URL of the PDF to download and extract text from."
    },
    "split_by": {
      "enum": [
        "page",
        "chunk"
      ],
      "type": "string",
      "default": "page",
      "description": "How to split the extracted text. 'page' returns per-page text; 'chunk' additionally returns contiguous text chunks."
    },
    "max_pages": {
      "type": "integer",
      "minimum": 1,
      "description": "Maximum number of pages to process, starting from page 1."
    },
    "pdf_base64": {
      "type": "string",
      "description": "Base64-encoded PDF bytes. Use this when you already have the PDF contents."
    },
    "user_agent": {
      "type": "string",
      "description": "Optional User-Agent header when fetching pdf_url. Overrides default and any environment value."
    },
    "strip_whitespace": {
      "type": "boolean",
      "default": true,
      "description": "If true, collapse excessive whitespace/newlines in extracted text."
    }
  },
  "description": "Exactly one of pdf_url or pdf_base64 must be provided. This is enforced at runtime.",
  "additionalProperties": false
}

Output

Variant 1

oktrue
pagesarray

Per-page extracted text.

Inspect pages structure

Per-page extracted text.

Array items
textstringrequired

Extracted text for this page.

page_numberintegerrequired

1-based page index.

No other fields are accepted.

chunksarray

Optional text chunks when split_by='chunk'. Omitted when split_by='page'.

Inspect chunks structure

Optional text chunks when split_by='chunk'. Omitted when split_by='page'.

Array items
textstringrequired

Chunk text.

indexintegerrequired

0-based index of the chunk.

end_pageintegeroptional

1-based index of the last page that contributed text to this chunk.

start_pageintegeroptional

1-based index of the first page that contributed text to this chunk.

No other fields are accepted.

metadataobject

Metadata about the extracted PDF.

additionalProperties:
true
Inspect metadata structure

Metadata about the extracted PDF.

urlstringoptional

The URL used to fetch the PDF, if any.

sourcestringoptional

Source type used for extraction, e.g. 'url' or 'base64'.

truncatedbooleanoptional

True if extraction stopped early due to max_pages.

page_countintegeroptional

Total number of pages in the PDF (may be greater than pages.length if truncated by max_pages).

raw_textstring

All page texts concatenated together (typically separated by newlines).

Variant 2

okfalse
errorobject
additionalProperties:
true
Inspect error structure
codestringoptional

Stable machine-readable error code (e.g. INPUT_INVALID, FETCH_FAILED, PARSE_FAILED).

detailsobjectoptional

Optional structured context (e.g. HTTP status, URL, page index).

messagestringrequired

Human-readable error message.

Complete output schema
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "ok",
        "pages",
        "raw_text"
      ],
      "properties": {
        "ok": {
          "const": true
        },
        "pages": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "page_number",
              "text"
            ],
            "properties": {
              "text": {
                "type": "string",
                "description": "Extracted text for this page."
              },
              "page_number": {
                "type": "integer",
                "description": "1-based page index."
              }
            },
            "additionalProperties": false
          },
          "description": "Per-page extracted text."
        },
        "chunks": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "index",
              "text"
            ],
            "properties": {
              "text": {
                "type": "string",
                "description": "Chunk text."
              },
              "index": {
                "type": "integer",
                "description": "0-based index of the chunk."
              },
              "end_page": {
                "type": "integer",
                "description": "1-based index of the last page that contributed text to this chunk."
              },
              "start_page": {
                "type": "integer",
                "description": "1-based index of the first page that contributed text to this chunk."
              }
            },
            "additionalProperties": false
          },
          "description": "Optional text chunks when split_by='chunk'. Omitted when split_by='page'."
        },
        "metadata": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "description": "The URL used to fetch the PDF, if any."
            },
            "source": {
              "type": "string",
              "description": "Source type used for extraction, e.g. 'url' or 'base64'."
            },
            "truncated": {
              "type": "boolean",
              "description": "True if extraction stopped early due to max_pages."
            },
            "page_count": {
              "type": "integer",
              "description": "Total number of pages in the PDF (may be greater than pages.length if truncated by max_pages)."
            }
          },
          "description": "Metadata about the extracted PDF.",
          "additionalProperties": true
        },
        "raw_text": {
          "type": "string",
          "description": "All page texts concatenated together (typically separated by newlines)."
        }
      },
      "additionalProperties": false
    },
    {
      "type": "object",
      "required": [
        "ok",
        "error"
      ],
      "properties": {
        "ok": {
          "const": false
        },
        "error": {
          "type": "object",
          "required": [
            "message"
          ],
          "properties": {
            "code": {
              "type": "string",
              "description": "Stable machine-readable error code (e.g. INPUT_INVALID, FETCH_FAILED, PARSE_FAILED)."
            },
            "details": {
              "type": "object",
              "description": "Optional structured context (e.g. HTTP status, URL, page index)."
            },
            "message": {
              "type": "string",
              "description": "Human-readable error message."
            }
          },
          "additionalProperties": true
        }
      },
      "additionalProperties": false
    }
  ]
}

Runtime & execution

What AgentPM provisions and runs on your machine.

Runtime
python 3.11
Entrypoint
python -u pdf_to_text/__main__.py
Timeout
120 s
Packaged files
1

Environment

No environment variables declared.

Declared by the author and read from your environment at run time. AgentPM neither supplies nor proxies credentials. Local runtime readiness is not evaluated here.

Reported by the Registry, for this version. A Registry-performed check is a Registry-reported result, not independent verification.

APDS conformance
Legacy inference; conformance not established
Integrity & provenance
4 recorded signals
  • Not applicable: Logical release digestRegistry recomputed metadata binding; archive bytes are not re-downloaded. Historical single archives have no logical release digest.Source: canonical release document and stored manifest/resolution/artifact inventory. Observed .
  • Author signature verified by RegistryRegistry namespace signer history; Ed25519 and exact statement binding. This is a Registry-performed check, not independent local verification by the reader or a safety guarantee.Source: stored provenance and Stage 1 verification contracts. Observed .
  • Registry attestation verified by RegistryRoot-signed Registry key set; exact origin, validity, key history and Ed25519 statement binding. This is a Registry-performed check, not independent local verification by the reader or a safety guarantee.Source: stored provenance and Stage 1 verification contracts. Observed .
  • Not evaluated: Dependency byte integrity not evaluatedUse a local verified installation to check the exact graph's downloaded bytes.Source: Registry metadata only. Observed .
Target support
1 artifact · legacy · provisioning not evaluated
License
Unknown · none declared by the author

Source

Legacy manifest: no explicit APDS declaration. Compatibility may be inferred; this is not verified conformance.

Full agent.json · v0.1.2
{
  "kind": "tool",
  "name": "pdf-to-text",
  "files": [
    "pdf_to_text/"
  ],
  "inputs": {
    "type": "object",
    "required": [],
    "properties": {
      "pdf_url": {
        "type": "string",
        "format": "uri",
        "description": "HTTP(S) URL of the PDF to download and extract text from."
      },
      "split_by": {
        "enum": [
          "page",
          "chunk"
        ],
        "type": "string",
        "default": "page",
        "description": "How to split the extracted text. 'page' returns per-page text; 'chunk' additionally returns contiguous text chunks."
      },
      "max_pages": {
        "type": "integer",
        "minimum": 1,
        "description": "Maximum number of pages to process, starting from page 1."
      },
      "pdf_base64": {
        "type": "string",
        "description": "Base64-encoded PDF bytes. Use this when you already have the PDF contents."
      },
      "user_agent": {
        "type": "string",
        "description": "Optional User-Agent header when fetching pdf_url. Overrides default and any environment value."
      },
      "strip_whitespace": {
        "type": "boolean",
        "default": true,
        "description": "If true, collapse excessive whitespace/newlines in extracted text."
      }
    },
    "description": "Exactly one of pdf_url or pdf_base64 must be provided. This is enforced at runtime.",
    "additionalProperties": false
  },
  "readme": "README.md",
  "$schema": "https://raw.githubusercontent.com/agentpm-dev/cli/refs/heads/main/schemas/agentpm.manifest.schema.json",
  "license": {
    "file": "LICENSE"
  },
  "outputs": {
    "oneOf": [
      {
        "type": "object",
        "required": [
          "ok",
          "pages",
          "raw_text"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "pages": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "page_number",
                "text"
              ],
              "properties": {
                "text": {
                  "type": "string",
                  "description": "Extracted text for this page."
                },
                "page_number": {
                  "type": "integer",
                  "description": "1-based page index."
                }
              },
              "additionalProperties": false
            },
            "description": "Per-page extracted text."
          },
          "chunks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "index",
                "text"
              ],
              "properties": {
                "text": {
                  "type": "string",
                  "description": "Chunk text."
                },
                "index": {
                  "type": "integer",
                  "description": "0-based index of the chunk."
                },
                "end_page": {
                  "type": "integer",
                  "description": "1-based index of the last page that contributed text to this chunk."
                },
                "start_page": {
                  "type": "integer",
                  "description": "1-based index of the first page that contributed text to this chunk."
                }
              },
              "additionalProperties": false
            },
            "description": "Optional text chunks when split_by='chunk'. Omitted when split_by='page'."
          },
          "metadata": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "description": "The URL used to fetch the PDF, if any."
              },
              "source": {
                "type": "string",
                "description": "Source type used for extraction, e.g. 'url' or 'base64'."
              },
              "truncated": {
                "type": "boolean",
                "description": "True if extraction stopped early due to max_pages."
              },
              "page_count": {
                "type": "integer",
                "description": "Total number of pages in the PDF (may be greater than pages.length if truncated by max_pages)."
              }
            },
            "description": "Metadata about the extracted PDF.",
            "additionalProperties": true
          },
          "raw_text": {
            "type": "string",
            "description": "All page texts concatenated together (typically separated by newlines)."
          }
        },
        "additionalProperties": false
      },
      {
        "type": "object",
        "required": [
          "ok",
          "error"
        ],
        "properties": {
          "ok": {
            "const": false
          },
          "error": {
            "type": "object",
            "required": [
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable machine-readable error code (e.g. INPUT_INVALID, FETCH_FAILED, PARSE_FAILED)."
              },
              "details": {
                "type": "object",
                "description": "Optional structured context (e.g. HTTP status, URL, page index)."
              },
              "message": {
                "type": "string",
                "description": "Human-readable error message."
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      }
    ]
  },
  "runtime": {
    "type": "python",
    "version": "3.11"
  },
  "version": "0.1.2",
  "entrypoint": {
    "args": [
      "-u",
      "pdf_to_text/__main__.py"
    ],
    "command": "python",
    "timeout_ms": 120000
  },
  "description": "Extract text from PDFs, either from a URL or base64-encoded PDF data."
}