Skip to main content

PDFDancer · PDF editing SDK · Python / TypeScript / Java

The PDF SDK for the hard stuff.

Complex PDFs. Precise edits.

Make changes to existing PDFs without rebuilding documents or compromising their layout. Even when the underlying PDF structure gets complicated.

  • Replace text across element boundaries.

    Find and replace words or phrases even when they're split across multiple PDF text elements.

  • Use the glyphs already in the PDF.

    Reuse glyphs across embedded font subsets, even when the original font file isn't available, as long as the replacement glyphs are in the PDF.

  • Choose what moves and what wraps.

    Keep text fixed, shift following text on the line, or rewrap supported text blocks. Choose how replacements affect the layout.

  • Replace fonts throughout a document.

    Replace fonts across an existing PDF, with automatic size adjustment to preserve the original appearance.

  • Replace outlined lettering with vector lettering.

    Replace outlined characters with new vector outlines, controlling font, tracking, positioning, fill, and stroke.

Replace text without losing control of the layout.

Python
from pathlib import Path
from pdfdancer import PDFDancer, TextLayoutProfile, TextReplaceRequest

with PDFDancer.open(pdf_data=Path("contract.pdf")) as pdf:
    request = (
        TextReplaceRequest.literal("30 days", "45 calendar days")
        .require_reflow(TextLayoutProfile.BODY_TEXT)
        .build()
    )
    result = pdf.page(1).text().replace(request)
    if result.errors or result.changed != 1:
        raise RuntimeError(result)
    pdf.save("updated-contract.pdf")

Replace text with longer content. Require rewrapping instead of silently falling back to a different layout behavior.

Text layout documentation

Inspect and coordinate your edits.

Analyze font choices and geometry before applying changes. Track replacement text through saving and reopening. Restore connected changes together when their application fails.

Bring your difficult PDF.

Put PDFDancer to work on the PDFs your current tools struggle with.

Try the SDK