Toolpal

@toolpal/pdf-toolkit

public

v2.0published 1 download this weekMIT

Local offline PDF toolkit with zero network access and no API key: inspect pages and metadata, merge multiple PDFs, split or extract page ranges, rotate pages, stamp text watermarks, extract embedded text page by page, and edit or strip document metadata.

An all-in-one local PDF toolkit — 100% offline (net: false) with zero API keys. Inspect, merge, split, rotate, watermark, extract text, and edit or scrub metadata on your own machine without uploading private documents to online converters.

Actions

ActionDescription
inspectReturns page count, per-page dimensions and rotation, file size, and document metadata
mergeCombines 2–50 PDFs (files) into a single PDF
splitExtracts a page selection (pages, e.g. "1-3, 5, 8-end") into one PDF, or splits every splitEvery pages into separate PDFs
rotateRotates all pages or a selected pages range by 90, 180, or 270 degrees
watermarkStamps a diagonal, header, or footer text watermark onto selected or all pages
extract_textExtracts embedded text page by page and writes a .txt output file
set_metadataUpdates title/author/subject/keywords, or strips all metadata with clearMetadata: true

Examples

Merge PDFs

{
  "action": "merge",
  "files": ["cover.pdf", "body.pdf", "appendix.pdf"],
  "filename": "complete-packet"
}

Watermark a draft

{
  "action": "watermark",
  "file": "proposal.pdf",
  "watermark": "CONFIDENTIAL DRAFT",
  "position": "diagonal",
  "opacity": 0.2
}

Extract specific pages

{
  "action": "split",
  "file": "annual-report.pdf",
  "pages": "1-3, 12-15"
}

Notes

  • Runs 100% offline (net: false, no environment variables).
  • Text extraction reads embedded PDF text layers (for scanned image-only PDFs, use OCR such as @toolpal/doc-extract).
  • Maximum file size: 50 MB per input PDF (100 MB total for merge).

Input

Validated before the workflow runs.

  • filefile

    Input PDF file (for inspect, split, rotate, watermark, extract_text, set_metadata)

  • filesfile[]

    min items 2 · max items 50

  • pagesstring

    1-based page selection, e.g. "1-3, 5, 8-end" (for split, rotate, watermark, extract_text)

    max length 200

  • actionrequired"inspect" | "merge" | "split" | "rotate" | "watermark" | "extract_text" | "set_metadata"

    Operation to perform: inspect, merge, split, rotate, watermark, extract_text, or set_metadata

  • degrees90 | 180 | 270

    For action: rotate — clockwise rotation in degrees (90, 180, or 270)

  • opacitynumber

    Watermark opacity (0.05–1); default 0.2

    ≥ 0.05 · ≤ 1

  • filenamestring

    Optional output filename stem without extension

    max length 80

  • fontSizeinteger

    Watermark font size; default 48 for diagonal, 12 for header/footer

    ≥ 8 · ≤ 120

  • metadataobject
  • metadata.titlestring

    max length 300

  • metadata.authorstring

    max length 300

  • metadata.creatorstring

    max length 200

  • metadata.subjectstring

    max length 500

  • metadata.keywordsstring[]

    max items 30

  • position"diagonal" | "header" | "footer"

    For action: watermark — placement; diagonal by default

  • watermarkstring

    For action: watermark — text to stamp on each selected page

    min length 1 · max length 120

  • splitEveryinteger

    For action: split — split into separate PDFs of N pages each (max 50 output files)

    ≥ 1 · ≤ 500

  • clearMetadataboolean

    For action: set_metadata — wipe existing title/author/subject/keywords/creator/producer

JSON Schema
{
  "type": "object",
  "required": [
    "action"
  ],
  "properties": {
    "file": {
      "type": "string",
      "description": "Input PDF file (for inspect, split, rotate, watermark, extract_text, set_metadata)",
      "x-toolpal-file": true
    },
    "files": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "Input PDF files to merge (in order)",
        "x-toolpal-file": true
      },
      "maxItems": 50,
      "minItems": 2
    },
    "pages": {
      "type": "string",
      "maxLength": 200,
      "description": "1-based page selection, e.g. \"1-3, 5, 8-end\" (for split, rotate, watermark, extract_text)"
    },
    "action": {
      "anyOf": [
        {
          "type": "string",
          "const": "inspect"
        },
        {
          "type": "string",
          "const": "merge"
        },
        {
          "type": "string",
          "const": "split"
        },
        {
          "type": "string",
          "const": "rotate"
        },
        {
          "type": "string",
          "const": "watermark"
        },
        {
          "type": "string",
          "const": "extract_text"
        },
        {
          "type": "string",
          "const": "set_metadata"
        }
      ],
      "description": "Operation to perform: inspect, merge, split, rotate, watermark, extract_text, or set_metadata"
    },
    "degrees": {
      "anyOf": [
        {
          "type": "number",
          "const": 90
        },
        {
          "type": "number",
          "const": 180
        },
        {
          "type": "number",
          "const": 270
        }
      ],
      "description": "For action: rotate — clockwise rotation in degrees (90, 180, or 270)"
    },
    "opacity": {
      "type": "number",
      "maximum": 1,
      "minimum": 0.05,
      "description": "Watermark opacity (0.05–1); default 0.2"
    },
    "filename": {
      "type": "string",
      "maxLength": 80,
      "description": "Optional output filename stem without extension"
    },
    "fontSize": {
      "type": "integer",
      "maximum": 120,
      "minimum": 8,
      "description": "Watermark font size; default 48 for diagonal, 12 for header/footer"
    },
    "metadata": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "maxLength": 300
        },
        "author": {
          "type": "string",
          "maxLength": 300
        },
        "creator": {
          "type": "string",
          "maxLength": 200
        },
        "subject": {
          "type": "string",
          "maxLength": 500
        },
        "keywords": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 80
          },
          "maxItems": 30
        }
      }
    },
    "position": {
      "anyOf": [
        {
          "type": "string",
          "const": "diagonal"
        },
        {
          "type": "string",
          "const": "header"
        },
        {
          "type": "string",
          "const": "footer"
        }
      ],
      "description": "For action: watermark — placement; diagonal by default"
    },
    "watermark": {
      "type": "string",
      "maxLength": 120,
      "minLength": 1,
      "description": "For action: watermark — text to stamp on each selected page"
    },
    "splitEvery": {
      "type": "integer",
      "maximum": 500,
      "minimum": 1,
      "description": "For action: split — split into separate PDFs of N pages each (max 50 output files)"
    },
    "clearMetadata": {
      "type": "boolean",
      "description": "For action: set_metadata — wipe existing title/author/subject/keywords/creator/producer"
    }
  }
}

Output

Validated before your agent receives it.

  • filefile

    Primary output file (.pdf or .txt)

  • textstring

    Extracted text (for extract_text)

  • bytesinteger
  • filesfile[]
  • pagesobject[]
  • actionrequiredstring
  • metadataobject
  • metadata.titlestring
  • metadata.authorstring
  • metadata.creatorstring
  • metadata.subjectstring
  • metadata.keywordsstring
  • metadata.producerstring
  • metadata.creationDatestring
  • metadata.modificationDatestring
  • pageCountrequiredinteger
  • pagesTextobject[]
JSON Schema
{
  "type": "object",
  "required": [
    "action",
    "pageCount"
  ],
  "properties": {
    "file": {
      "type": "string",
      "description": "Primary output file (.pdf or .txt)",
      "x-toolpal-file": true
    },
    "text": {
      "type": "string",
      "description": "Extracted text (for extract_text)"
    },
    "bytes": {
      "type": "integer"
    },
    "files": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "Multiple output PDFs (for splitEvery)",
        "x-toolpal-file": true
      }
    },
    "pages": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "page",
          "width",
          "height",
          "rotation"
        ],
        "properties": {
          "page": {
            "type": "integer"
          },
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          },
          "rotation": {
            "type": "integer"
          }
        }
      }
    },
    "action": {
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string"
        },
        "author": {
          "type": "string"
        },
        "creator": {
          "type": "string"
        },
        "subject": {
          "type": "string"
        },
        "keywords": {
          "type": "string"
        },
        "producer": {
          "type": "string"
        },
        "creationDate": {
          "type": "string"
        },
        "modificationDate": {
          "type": "string"
        }
      }
    },
    "pageCount": {
      "type": "integer"
    },
    "pagesText": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "page",
          "text"
        ],
        "properties": {
          "page": {
            "type": "integer"
          },
          "text": {
            "type": "string"
          }
        }
      }
    }
  }
}