# PDF Modifier [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/mlorentedev/pdf-modifier  
**GitHub Stars:** 3  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/pdf-modifier

## Description
Modify PDF text, replace with regex, and analyze layout while preserving fonts.

## Tools
Capabilities this server exposes over MCP:

- **read_pdf_structure** — Extract the complete structural content of a PDF document.

Returns detailed information about each page including:
- Page dimensions (width, height)
- All text elements with their:
  - Exact text content
  - Bounding box coordinates (x0, y0, x1, y1)
  - Origin point for text insertion
  - Font name and size
  - Color value

Use this tool FIRST to understand the document layout before
making any modifications. The output helps identify exact text
to target for replacements.
- **inspect_pdf_fonts** — Search for specific text terms and report their font properties.

Use this tool to understand the exact font styling of text you
want to replace. This ensures replacements will match the
surrounding document style as closely as possible.

The tool searches through all pages and returns matches with:
- Page number where the term was found
- The search term that matched
- Surrounding context (first 100 characters)
- Font name (e.g., "Helvetica-Bold", "Times-Roman")
- Font size in points
- Origin coordinates for precise positioning
- **modify_pdf_content** — Find and replace text in a PDF while preserving font styles.

This tool performs text replacement by:
1. Locating all occurrences of the search text
2. Redacting the original text (white fill)
3. Inserting the replacement text with matched styling

IMPORTANT BEHAVIORS:
- Text is matched within individual text spans
- Font style is approximated using Base 14 fonts (Helvetica, Times, Courier)
- Replacement text should be similar length to avoid overlap
- Multiple replacements can be specified in a single call

HYPERLINK SUPPORT:
- Append "|URL" to create a clickable link: "Click Here|https://example.com"
- Use "|void(0)" to neutralize existing links: "Product|void(0)"

REGEX SUPPORT:
- Set use_regex=true to treat keys as regex patterns
- Useful for matching dates, IDs, or variable content
- Example: {"Order #\d+": "Order #REDACTED"}
- **list_pdf_hyperlinks** — Extract all existing hyperlinks and clickable URIs from a PDF.

Use this tool to inventory the links in a document before or after
making modifications. It reports the target URI, its location (bbox),
and the text covered by the link if detectable.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "pdf-modifier": {
    "command": "uvx",
    "args": ["pdf-modifier"]
  }
}
```

## Documentation

## What PDF Modifier does

PDF Modifier provides an MCP interface for examining and changing text-based PDF content. It is designed for edits where page layout and typographic appearance matter. Agents can inspect page dimensions, text placement, font information, and existing hyperlinks before applying changes.

The main editing operation finds text inside PDF text spans, covers the original content with a white redaction area, and writes the replacement at the detected position. Replacement styling is derived from the matched text, with Base 14 fonts used to approximate the original family and weight. Matching text of a similar length helps reduce the chance of overlap.

The project also includes a command-line interface and a web interface, but the MCP integration is the relevant entry point for agent-driven workflows. The command-line package supports batch processing and regex-based replacement outside MCP as well.

## How it works

A typical workflow starts with `read_pdf_structure`. This returns each page’s dimensions and text elements, including their exact content, bounding boxes, insertion origins, font names, sizes, and color values. The structural output can be used to identify the precise text span that should be changed.

`inspect_pdf_fonts` searches the document for a supplied term and reports matching pages, nearby context, font details, and coordinates. Use it when an edit needs to reproduce the styling of a particular occurrence.

After inspection, `modify_pdf_content` accepts one or more replacements. It can match literal text within individual spans or interpret replacement keys as regular expressions when regex mode is enabled. A value formatted as `text|URL` creates a clickable link, while `text|void(0)` can neutralize an existing link during replacement.

`list_pdf_hyperlinks` inventories clickable URIs, including their target addresses, locations, and covered text when detectable. Running it before and after an edit can help verify link-related changes.

## Setup and configuration

The package requires Python 3.12 or newer. Install it with:

```bash
pip install pdf-modifier
```

For an MCP client using the `uvx` launcher, the documented Claude setup command is:

```bash
claude mcp add -s user pdf-modifier -- uvx pdf-modifier
```

The MCP process is named `pdf-modifier`. The project also exposes a CLI command, `pdf-mod`, for scripted PDF modifications, including commands such as:

```bash
pdf-mod modify input.pdf output.pdf -r "Draft=Final"
```

No environment variables are required by the documented setup. The repository is licensed under MIT.

## Tools and capabilities

- `read_pdf_structure`: Extract page geometry and detailed text-element metadata.
- `inspect_pdf_fonts`: Find terms and report their surrounding font and position information.
- `modify_pdf_content`: Replace literal or regex-matched text while applying detected styling.
- `list_pdf_hyperlinks`: Locate existing clickable links and their PDF coordinates.
- Multiple replacements can be submitted in one modification call.
- Regex patterns are useful for changing variable dates, identifiers, or other repeated content.

## Limitations and notes

Text matching occurs within individual text spans rather than across arbitrary combinations of spans. Replacement fonts are approximated with Base 14 families such as Helvetica, Times, and Courier, so the result may not reproduce every embedded font exactly. Keep replacement strings close in length to the originals to limit overlap with nearby content.

The structure inspection tool should be used before editing so that an agent can identify the correct text and its layout. Font inspection is useful when visual consistency depends on the exact styling of a target. Hyperlink text may be detectable separately from its target URI, so link verification should account for both pieces of information.

_Full upstream README: https://allmcps.com/mcp/pdf-modifier/readme_

