Structure-based PDF Steganography tool
Project description
pdf-stego
Structure-based PDF watermarking — implementation of the scheme from Jiang et al. [1].
Embeds watermarks or arbitrary payloads as dictionary entries in Font Dictionary Objects and XObjects within the PDF structure. The embedding is invisible, produces zero visual distortion (SSIM = 1.0), and survives content editing, page extraction, and textbox-level attacks.
Note: Most of the code was generated by Claude Opus 4.6 and Gemini 3.1 Pro running in Antigravity.
Installation
With uv
uv sync
This installs the package in development mode with all dependencies.
With pip + venv
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
pip install -e .
Usage
CLI
Tip: Run
pdf-stego --helporpdf-stego <command> --help(e.g.pdf-stego embed --help) to see all available flags for each subcommand.
# Embed a payload (split across objects, default mode)
pdf-stego embed -i document.pdf -o payload.pdf -f payload.txt
# Embed a watermark (redundant copy to every object)
pdf-stego embed -i document.pdf -o watermarked.pdf -m "my watermark" --mode watermark
# Embed with AES encryption and explicit ordering
pdf-stego embed -i document.pdf -o encrypted-payload.pdf -m "secret" --encryption aes --key "passphrase" --order forwards
# Extract (flags must match what was used during embed)
pdf-stego extract -i payload.pdf
pdf-stego extract -i watermarked.pdf --mode watermark
pdf-stego extract -i encrypted-payload.pdf --encryption aes --key "passphrase" --order forwards
# Show object counts and watermark status
pdf-stego info -i document.pdf
Important: Extraction requires the same
--mode,--order,--seed,--channel, and--encryption/--keyflags that were used during embedding.
Python API
from pdf_stego import embed, extract, info
# Embed
embed("input.pdf", "output.pdf", "my watermark", mode="watermark")
# Embed with encryption
embed("input.pdf", "output.pdf", "secret", encryption="aes", encryption_key="passphrase")
# Embed payload from a file
from pathlib import Path
embed("input.pdf", "output.pdf", Path("payload.txt"))
# Extract (parameters must match embed)
data = extract("watermarked.pdf")
data = extract("watermarked.pdf", encryption="aes", encryption_key="passphrase")
data = extract("watermarked.pdf", mode="watermark", output="extracted.bin")
# Inspect
info("document.pdf")
Modes
payload(default) — Base64-encodes the input and splits it across available objects to maximize capacity. Each chunk is independently decodable. Can be ordered via--order(forwards,backwards, orrandom). A--seedcan be supplied forrandomordering (default:0).watermark— Embeds the full data into every available object for maximum redundancy and survivability.
Channels
font— Embed in Font Dictionary Objects onlyxobject— Embed in Image/Form XObjects onlyboth(default) — Embed in both channels
Encryption
none(default) — No encryptionaes— AES-256-GCM with PBKDF2 key derivation
Reference
[1] Jiang, Z., Wang, H. & Han, S. A robust PDF watermarking scheme with versatility and compatibility. Multimed Tools Appl 83, 64341-64367 (2024). https://doi.org/10.1007/s11042-024-18151-w
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdf_stego-0.1.0.tar.gz.
File metadata
- Download URL: pdf_stego-0.1.0.tar.gz
- Upload date:
- Size: 99.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2395a4bf4d1c286f02dfaf81e1e0ffa6d95331669374457ef9bf16212637f4f
|
|
| MD5 |
177e609c652406a45812d2a337c89b0b
|
|
| BLAKE2b-256 |
08fd87456279247f9547825bffad55a27dd4048b6e6ac9029d5e2bae94f97f25
|
File details
Details for the file pdf_stego-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pdf_stego-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df6b170f75408ae54eb4c1ddc6340022dd37c1a6d9a7da3f011a41a5640a1540
|
|
| MD5 |
839880dd45f7f9ec2bc7cf7e3cad1a59
|
|
| BLAKE2b-256 |
4eccdf5a3048c508b6cd7f4b1cd77408b757765c7adb37f471d782db12dd0d5f
|