# How to Upgrade pdf-inspector to the Latest Version: Complete Guide for Rust, Python, Node.js, and WebAssembly

> Easily upgrade pdf-inspector to the latest version with our guide. Learn commands for Rust, Python, Node.js, and WebAssembly to keep your tools updated.

- Repository: [Firecrawl/pdf-inspector](https://github.com/firecrawl/pdf-inspector)
- Tags: migration-guide
- Published: 2026-08-04

---

**To upgrade pdf-inspector to the latest version, use the appropriate package manager command for your distribution channel: `cargo install pdf-inspector --force` for CLI tools, `cargo add pdf-inspector@latest` for Rust crates, `pip install --upgrade pdf-inspector` for Python, or `npm install @firecrawl/pdf-inspector@latest` for Node.js.**

The pdf-inspector project distributes its PDF processing engine through multiple channels—Rust crate, CLI binaries, Python bindings, Node.js N-API, and WebAssembly—all synchronized to a single version number defined in [`Cargo.toml`](https://github.com/firecrawl/pdf-inspector/blob/main/Cargo.toml)【/cache/repos/github.com/firecrawl/pdf-inspector/main/Cargo.toml#L3-L4】. This unified release model means upgrading any component gives you the newest detection algorithms, extraction heuristics, and markdown generation logic.

## Upgrade Commands by Distribution Channel

| Channel | Upgrade Command | Use Case |
|---------|---------------|----------|
| **Rust crate** (library dependency) | `cargo add pdf-inspector@latest` or edit [`Cargo.toml`](https://github.com/firecrawl/pdf-inspector/blob/main/Cargo.toml) + `cargo update` | Downstream Rust projects consuming the library |
| **CLI binaries** (`pdf2md`, `detect-pdf`, `dump_ops`) | `cargo install pdf-inspector --force` | Global installation of command-line tools |
| **Python binding** | `pip install --upgrade pdf-inspector` | Python applications using `pdf_inspector` module |
| **Node.js (N-API)** | `npm install @firecrawl/pdf-inspector@latest` | Server-side JavaScript/TypeScript projects |
| **WebAssembly** | `npm install @firecrawl/pdf-inspector-wasm@latest` | Browser or edge-runtime deployments |
| **Source build** | `git pull origin main && cargo build --release` | Contributors or custom builds |

All channels share the same version because every public entry point—whether `process_pdf` in the library, the CLI binaries, or language bindings—ultimately calls the same internal code paths.

## Step-by-Step Upgrade Instructions

### 1. Check Your Current Version

Before upgrading, verify what version you currently have installed:

```bash

# Rust dependency tree

cargo tree -i pdf-inspector

# CLI tool

pdf2md --version

# Python

python -c "import pdf_inspector, sys; print(pdf_inspector.__version__)"

# Node.js

npm list @firecrawl/pdf-inspector

```

### 2. Upgrade the Rust Crate in Your Project

For Rust projects using pdf-inspector as a dependency, update your [`Cargo.toml`](https://github.com/firecrawl/pdf-inspector/blob/main/Cargo.toml):

```toml
[dependencies]
pdf-inspector = "0.2"

```

Then run:

```bash
cargo update

```

This fetches the newest compatible version from crates.io and rebuilds your project with updated dependencies.

### 3. Upgrade the CLI Binaries Globally

To install or overwrite the latest pre-compiled binaries:

```bash
cargo install pdf-inspector --force

```

The `--force` flag ensures older local copies are replaced. This installs three binaries: `pdf2md`, `detect-pdf`, and `dump_ops`.

### 4. Upgrade the Python Binding

For PyPI-published wheels:

```bash
pip install --upgrade pdf-inspector

```

For development builds from source:

```bash
pip install maturin
maturin develop --release

```

The Python bindings are implemented in [`src/python.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/python.rs) using PyO3, exposing the same `process_pdf` function used by all other interfaces.

### 5. Upgrade the Node.js and WebAssembly Bindings

For server-side Node.js:

```bash
npm install @firecrawl/pdf-inspector@latest

```

For browser or WASM environments:

```bash
npm install @firecrawl/pdf-inspector-wasm@latest

```

Both packages are documented in [`napi/README.md`](https://github.com/firecrawl/pdf-inspector/blob/main/napi/README.md) and [`wasm/README.md`](https://github.com/firecrawl/pdf-inspector/blob/main/wasm/README.md) respectively.

### 6. Upgrade from Source (Git Checkout)

If you compile from the firecrawl/pdf-inspector repository directly:

```bash
git fetch --prune
git checkout main
git pull
cargo build --release

```

This brings your local copy to the latest commit and rebuilds all artifacts.

## Verify Your Upgrade

After upgrading, confirm the new version is active:

```bash
pdf2md --version

```

For programmatic verification, run a quick detection or conversion:

```python

# Python verification

import pdf_inspector

result = pdf_inspector.process_pdf("sample.pdf")
print(result.pdf_type)  # e.g., "text_based"

print(result.markdown[:200])

```

```javascript
// Node.js verification
import { readFileSync } from "fs";
import { processPdf } from "@firecrawl/pdf-inspector";

const pdf = readFileSync("sample.pdf");
const out = processPdf(pdf);
console.log(out.pdfType);  // "TextBased"

```

```rust
// Rust verification
use pdf_inspector::process_pdf;

fn main() -> Result<(), pdf_inspector::PdfError> {
    let result = process_pdf("sample.pdf")?;
    println!("PDF type: {:?}", result.pdf_type);
    Ok(())
}

```

## Key Source Files Affected by Upgrades

Understanding where the version number and core logic live helps troubleshoot upgrade issues:

| File | Purpose | Location |
|------|---------|----------|
| [`Cargo.toml`](https://github.com/firecrawl/pdf-inspector/blob/main/Cargo.toml) | Version source of truth and release trigger | [`Cargo.toml`](https://github.com/firecrawl/pdf-inspector/blob/main/Cargo.toml) |
| [`src/lib.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/lib.rs) | Public API (`process_pdf`, `process_pdf_with_options`) | [`src/lib.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/lib.rs) |
| [`src/detector.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/detector.rs) | PDF classification algorithms | [`src/detector.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/detector.rs) |
| [`src/extractor/mod.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/extractor/mod.rs) | Core text-extraction pipeline | [`src/extractor/mod.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/extractor/mod.rs) |
| [`src/markdown/convert.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/markdown/convert.rs) | Markdown generation logic | [`src/markdown/convert.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/markdown/convert.rs) |
| [`src/bin/pdf2md.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/pdf2md.rs) | Markdown converter CLI | [`src/bin/pdf2md.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/pdf2md.rs) |
| [`src/bin/detect_pdf.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/detect_pdf.rs) | PDF type detector CLI | [`src/bin/detect_pdf.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/bin/detect_pdf.rs) |
| [`src/python.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/python.rs) | Python FFI bindings | [`src/python.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/python.rs) |

When you upgrade pdf-inspector to the latest version, you automatically receive improvements to the detection logic in [`src/detector.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/detector.rs), extraction pipeline in [`src/extractor/mod.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/extractor/mod.rs), and markdown post-processing in [`src/markdown/convert.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/markdown/convert.rs).

## Summary

- **One version, multiple channels**: All pdf-inspector distributions share the version in [`Cargo.toml`](https://github.com/firecrawl/pdf-inspector/blob/main/Cargo.toml)【/cache/repos/github.com/firecrawl/pdf-inspector/main/Cargo.toml#L3-L4】.

- **Match your upgrade command to your use case**: `cargo install` for CLI, `cargo add`/`cargo update` for Rust projects, `pip install --upgrade` for Python, `npm install` for Node.js/WebAssembly.

- **Verify with `--version` or a test call**: Confirm the upgrade succeeded by checking version output or running `process_pdf`.

- **Source builds require `git pull` + `cargo build --release`**: Stay on the bleeding edge with manual compilation.

## Frequently Asked Questions

### What if I have multiple versions installed in different environments?

Each package manager manages its own isolation. Use `which pdf2md` (Unix) or `where pdf2md` (Windows) to locate CLI binaries. For Python, check `pip show pdf-inspector` or `python -m site` to identify which environment owns the package. Node.js users can run `npm list -g @firecrawl/pdf-inspector` versus `npm list @firecrawl/pdf-inspector` (local) to distinguish global from project-scoped installations.

### Why does the Python binding require `maturin` for source builds?

The Python bindings in [`src/python.rs`](https://github.com/firecrawl/pdf-inspector/blob/main/src/python.rs) use PyO3 to generate native extensions from Rust source. Maturin handles the compilation and packaging of these extensions into wheels compatible with your Python interpreter. Pre-built wheels on PyPI eliminate this requirement for most users.

### How do I pin to a specific version instead of latest?

Specify the exact version in your dependency declaration:
- Rust: `pdf-inspector = "=0.2.6"` in [`Cargo.toml`](https://github.com/firecrawl/pdf-inspector/blob/main/Cargo.toml)
- Python: `pip install pdf-inspector==0.2.6`
- Node.js: `npm install @firecrawl/pdf-inspector@0.2.6`

This prevents automatic upgrades while still allowing manual version control.