CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

testland/pdf-snapshot-tester

Use when generated PDFs (invoices, contracts, regulatory filings) must not shift layout, or a template, font or PDF library is changing. Renders pages to images and pixel-diffs them against approved baselines, strips volatile metadata, and compares HTML-to-PDF engines.

Quality

91%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files

deterministic-rendering.mdreferences/

Deterministic PDF rendering

Non-deterministic PDF metadata and host font substitution are the two environment factors that invalidate baselines. Normalize both before diffing, or rely on image diff (which is metadata-free by construction).

Strip non-deterministic PDF metadata

PDFs include /CreationDate, /ID, sometimes /ModDate. These change per run and break byte diffs. Use qpdf to normalize:

qpdf --linearize \
     --object-streams=disable \
     --replace-stream-data=uncompress \
     --remove-attachments \
     out.pdf normalized.pdf

Alternative: rely on image diff (render + pixel-diff) which is metadata-free by construction.

Font-substitution detection

Missing fonts on the rendering host produce visually-different output. Detect via Poppler stderr:

import subprocess

result = subprocess.run(
    ["pdfinfo", "-list-embedded-fonts", "out.pdf"],
    capture_output=True, text=True,
)
if "Font Substitution" in result.stderr:
    raise RuntimeError("Font substitution detected; baseline invalid")

For CI, install the production font pack via the package manager or check fonts into the repo for deterministic builds.

SKILL.md

tile.json