Skip to main content

PDF Injector

A tool for injecting invisible text into PDF files. The text is invisible to human viewers but can be detected by text extraction tools and LLMs.

Installation

From PyPI

pip install pdf-injector

From Source

git clone https://github.com/larsyencken/pdf-injector.git
cd pdf-injector
make .venv

Development

This project uses:

  • ruff for linting and formatting
  • pyright for type checking
  • pytest for unit testing

Common Tasks

# Set up the development environment
make .venv

# Format code
make tidy

# Check formatting
make checkformatting

# Run unit tests
make unittest

# Run type checking
make typecheck

# Run all checks
make test

# Clean up environment
make clean

Usage

When installed from PyPI

pdf-injector input.pdf output.pdf "Text to inject invisibly"

When running from source

python main.py input.pdf output.pdf "Text to inject invisibly"

Arguments:

  • input_pdf: Path to the existing PDF file
  • output_pdf: Path where the modified PDF will be saved
  • text: Text to inject (will be invisible to humans but readable by machines)

How It Works

This tool uses Text Rendering Mode 3 in the PDF specification, which renders text as invisible but still includes it in the document content stream. This means:

  1. The text is not visible when viewing the PDF
  2. The text is still part of the document structure
  3. Text extraction tools and LLMs can still "read" the invisible text

Technical Details

  • Uses PyPDF for reading/writing PDF files
  • Uses ReportLab for creating the invisible text layer
  • Applies the invisible text to each page of the input PDF

Changelog

0.1.1 (2025-04-23)

  • Improved text rendering mode implementation for true invisibility
  • Added CI workflow for automated testing
  • Fixed package installation and entry point configuration
  • Added distribution and publishing capabilities
  • Added command-line tool with pip installation support

0.1.0 (2025-04-23)

  • Initial implementation of PDF text injector
  • Support for injecting invisible text into PDF files
  • Basic test suite and documentation

Metadata

Release files for pdf-injector 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdf-injector 0.1.1
File Size Uploaded Provenance
pdf_injector-0.1.1.tar.gz 4.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pdf-injector 0.1.1
File Interpreter ABI Platform
pdf_injector-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / pdf_injector-0.1.1.tar.gz

Download URL pdf_injector-0.1.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e563691f9234cac02a1b301d02a27b16827a1de7b1cdcf4d13815377e86fdf76
BLAKE2b-256 checksum
How to use checksums
6688e957ba1e882ca33bd329a8eca38f4bda5c24e8bd86ba137a3063243650e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / pdf_injector-0.1.1-py3-none-any.whl

Download URL pdf_injector-0.1.1-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
080cf8be5be420bb6b98650684e0c12fd25dc3e169de4d8ef851a7f62029205d
BLAKE2b-256 checksum
How to use checksums
f64a42120fe09808dc625874d9466c364f90e90dff2e87512e13f721735cbf4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Security for pdf-injector 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page