I built a tool that finds "invisible text" hidden in PDFs — white text, tiny fonts, and the invisible render mode
A PDF can contain text that no human will ever see but that is still there as data. White text on white paper. Text at 0.4 pt. Text marked "do not draw". Text placed outside the page. All of it is within the PDF specification, and none of it shows up in Acrobat. Every program that extracts text mechanically reads all of it anyway. Copy and paste does. Search does. And so does the AI you asked to…
A PDF can contain invisible text that is still there as data, including white text, very small fonts, and render modes that do not display the text. Despite this, mechanical text extraction programs like Acrobats and AI summarizers read all of it. An AI might summarize a PDF without noticing hidden instructions aimed at human reviewers.
A recent example found white text in academic preprints instructing AI reviewers to give the paper an outstanding rating. This issue has become practical with the increased use of AI to read documents. To address this, I created a Windows desktop app that draws red boxes on the PDF page wherever it detects invisible text, along with a list of findings.
The app focuses on the detection logic and thresholds, and how to handle false positives. The app is built using Python, the pypdfium2 library for PDF parsing and rendering, Pillow for image processing, and pywebview for the GUI. Other PDF parsing libraries like PyMuPDF were rejected due to their AGPL license. The detection engine is a single file called hidden_core.py.
The article covers the text-layer part of the detection logic. Hidden text in PDFs can be achieved through various tricks, such as using the same color as the background, tiny fonts, invisible render mode, zero-opacity ExtGState, placing text outside the visible area, covering it with shapes or images, clipping it away, using hidden layers, or embedding it in unreferenced form XObjects.
The detection logic includes attribute rules and a render diff to identify the hidden text accurately. Some cases, like text render mode 3, are not considered malicious and are handled with a different approach.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.