---
title: pdf-textlayer
description: Add an invisible, searchable text layer to a PDF from OCR JSON. One Rust core, shipped as a CLI, a Python package, and a Node.js package.
sidebar:
  label: Introduction
  icon: house
---

Give pdf-textlayer a PDF and the JSON your OCR pipeline wrote for it. It writes a new PDF where every OCR word sits at its bounding box as invisible text (PDF render mode 3). The page looks exactly the same, and `Ctrl+F`, copy and paste, screen readers, and search indexers now find the words.

```bash
lit parse scan.pdf --format json --extract-text-metadata -o parsed.json
pdf-textlayer scan.pdf parsed.json searchable.pdf
```

## Why use it

- **Mixed PDFs come out right.** A 200-page contract with two scanned exhibits gets text only on the scanned pages. Native text, embedded fonts, and annotations pass through untouched, and an OCR word that lands on a word the page already has is skipped.
- **Every script is kept.** CJK, Cyrillic, Greek, and the rest of the Basic Multilingual Plane are written as real text, with no font to pick.
- **Fast.** A 500-page scan with 22,500 OCR boxes takes about 0.4 s. See [Benchmarks](/project/benchmarks).
- **No runtime dependencies.** Each package is one compiled library.
- **One core, three ways in.** The writer is Rust. The CLI, the Python package, and the Node.js package all run the same code, so output is identical across them.

## Pick your package

**[CLI](/reference/cli)**

Installed by every package below, and by `cargo install`.

**[Python](/reference/python)**

`pip install pdf-textlayer`. Typed API, Python 3.11+.

**[Node.js](/reference/node)**

`npm install pdf-textlayer`. ESM and CommonJS, Node.js 20+.

**[Rust](/reference/rust)**

`cargo add pdf-textlayer`. The library the others wrap.

New here? Start with the [Quickstart](/quickstart).
