Skip to main content

PDF Hidden Text Inspector

Inspect PDFs for text that extraction can read but a person may not see or easily notice on the page. The tool compares native PDF text with rendered pixels and local OCR, then writes an HTML evidence report and machine-readable JSON. It runs locally and does not send PDFs to a model or cloud service.

This is an early inspection tool. Findings need human review; a completed scan is not a claim that a PDF is safe.

Install

Requires Python 3.10 or newer.

py -m pip install pdf-hidden-text-inspector

Until the first PyPI release, install from a local copy of this project:

py -m pip install .

Windows uses built-in Windows OCR by default. On other systems, install Tesseract separately and make sure its executable is on PATH. OCR can be disabled with --ocr none, but the resulting scan will be marked partial.

Use

inspect-pdf-hidden-text "C:\path\document.pdf" --out report

Open report/report.html to review highlighted page images and findings. Use report/report.json for structured results. Options include --ocr auto|windows|tesseract|none, --lang eng, and --max-pages N. For example:

inspect-pdf-hidden-text "C:\path\document.pdf" --out report --ocr tesseract --lang eng+chi_tra

Exit code 0 means all implemented checks completed. Exit code 2 means coverage is partial, such as when OCR is unavailable, pages were skipped, or a page failed. The report records the specific coverage and errors. Neither exit code is a security verdict.

Reports contain extracted document text and rendered pages. Handle them like the source PDF.

What it checks

The inspector highlights very small or invisible PDF text, near-transparent text, text outside the visible page, regions with little rendered variation, and differences between native text and OCR in the same region. It also checks selected metadata and annotation fields for instruction-like wording. It distinguishes a possible legitimate OCR text layer when invisible text agrees with visible OCR.

The heuristic checks can produce false positives, especially for formulas, unusual fonts, and languages that OCR handles poorly. Some PDF channels are not covered, including disabled optional-content layers, arbitrary clipping, attachment contents, and historical revisions. The project source includes further coverage notes.

Develop and test

py -m pip install -r inspect-pdf-hidden-text/requirements.txt
py -m pip install reportlab
py inspect-pdf-hidden-text/tests/test_inspector.py --out outputs/tests

The controlled fixtures exercise concealment methods, normal text, white text on a dark panel, OCR overlays, annotation text, and partial coverage. The packaged command and the underlying script share the same scanner.

中文簡介

這個工具在本機檢查 PDF 中「文字擷取讀得到,但頁面畫面看不到或難以閱讀」的內容,輸出 HTML 與 JSON 證據報告。候選項目需要人工確認;完成掃描不代表檔案安全。Windows 預設使用本機 Windows OCR,其他系統需要安裝 Tesseract。

Metadata

Release files for pdf-hidden-text-inspector 0.2.0

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-hidden-text-inspector 0.2.0
File Size Uploaded
pdf_hidden_text_inspector-0.2.0.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pdf-hidden-text-inspector 0.2.0
File Interpreter ABI Platform
pdf_hidden_text_inspector-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.0 kB

Release files / pdf_hidden_text_inspector-0.2.0.tar.gz

Download URL pdf_hidden_text_inspector-0.2.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b8723be26dd7e0c75c00d04410ef6f261cebd6850c7094576bc81a81af8a7ebe
BLAKE2b-256 checksum
How to use checksums
c0b8d8364495e6fb967ce6f7f56f3f61e3866c94c752a049e2fff1bc95e03487
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / pdf_hidden_text_inspector-0.2.0-py3-none-any.whl

Download URL pdf_hidden_text_inspector-0.2.0-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c43aa306e86621465ed7f72c8b9d561d5f4d8ebbba64ac8d9bdb9d4dd7b3bd1c
BLAKE2b-256 checksum
How to use checksums
7d43a0374d359f1b73024bf2b0cfa478facaca684d5cb66136167848093e8faf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

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