# pdflinkcheck-rust

The high-performance Rust core for `pdflinkcheck`. This package provides native PDF analysis capabilities using PDFium via PyO3 bindings.

## Prerequisites

- **Rust & Cargo**: [Install here](https://rustup.rs/)
    
- **Python 3.10+**
    
- **Maturin**: `uv tool install maturin` or `pip install maturin`
    
- **libpdfium.so**: This project requires a compiled PDFium shared library.
    

## Project Structure

- `src/`: Rust source code (PyO3 bindings and analysis logic).
    
- `pdflinkcheck_rust/`: Python package wrapper.
    
- `pdflinkcheck_rust/libpdfium.so`: The PDFium binary (must be present for the engine to function).
    

## Development

To compile the Rust code and install the package into your current virtual environment:

Bash

```
# Ensure libpdfium.so is in pdflinkcheck_rust/
maturin develop
```

To run the standalone Rust CLI:

Bash

```
cargo build --release
./target/release/pdflinkcheck-rust <path_to_pdf>
```

## Environment Configuration

Because the Rust engine links to PDFium at runtime, you may need to point your library loader to the package directory during local testing:

Bash

```
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/pdflinkcheck_rust
```

## Building for Distribution

To create a wheel for installation in other projects:

Bash

```
maturin build --release
```

The resulting wheel will be located in `target/wheels/`.
