Skip to main content

Tool for injecting invisible text into PDFs

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf_injector-0.1.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf_injector-0.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file pdf_injector-0.1.1.tar.gz.

File metadata

  • Download URL: pdf_injector-0.1.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pdf_injector-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e563691f9234cac02a1b301d02a27b16827a1de7b1cdcf4d13815377e86fdf76
MD5 8e5b4c35cfc87ab7c639b63272838474
BLAKE2b-256 6688e957ba1e882ca33bd329a8eca38f4bda5c24e8bd86ba137a3063243650e8

See more details on using hashes here.

File details

Details for the file pdf_injector-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pdf_injector-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pdf_injector-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 080cf8be5be420bb6b98650684e0c12fd25dc3e169de4d8ef851a7f62029205d
MD5 b8861606a33826eb7070f2a20b62eef0
BLAKE2b-256 f64a42120fe09808dc625874d9466c364f90e90dff2e87512e13f721735cbf4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page