Skip to content

Audit documents locally

docgate audit inspects extraction and rendering risks without rendering pages, loading provider credentials, or making a network call. It is useful before choosing an OCR provider or allowing a document into a paid pipeline.

docgate audit bundle.pdf

Example summary:

format: pdf
pages: 31
text layer: 27
requires OCR: 4
predicted clamps: 1
embedded images: 6
max pixel buffer: 23 MB
inspection complete: true

Machine-readable output

docgate audit bundle.pdf --json

The versioned JSON contains page numbers, local extraction status, character counts, image counts and dimensions, predicted render pixels, and findings. It does not contain the source path, filename, extracted text, image bytes, or credentials.

An incomplete inspection exits with code 2 and returns an encrypted or inspection_failed finding without copying exception details that could expose a private path.

Offline visual report

docgate audit bundle.pdf --report audit.html

The static HTML page displays summary cards, a color-coded page map, render clamps, and a findings table. It loads no external scripts, fonts, images, or styles and includes a restrictive Content Security Policy. Like audit JSON, it contains no document text, image bytes, source path, or filename.

Use report.to_html() to generate the same artifact through the Python API.

Findings

Finding Meaning
ocr_required Local inspection found no usable text layer.
image_only The page has image XObjects but no usable text layer.
no_local_content No usable text or image XObject was found. The page may be blank or unreadable.
embedded_images A text-layer page also has images that may contain additional text.
render_clamp_predicted A 220-DPI render would exceed the configured output-pixel bound.
encrypted The document could not be inspected without decryption.
inspection_failed Local inspection could not complete.

no_local_content deliberately does not claim the page is blank. Rendering and OCR are required to distinguish a genuinely blank page from content the local parser could not read.

Python API

import docgate

report = docgate.audit("bundle.pdf")
print(report.requires_ocr_pages)
print(report.predicted_clamp_pages)
print(report.to_dict())

The audit is an extraction preflight, not a malware scan or compliance verdict.