Published 2025-11-21
A tiny CLI tool to lint PDF files. It inspects page boxes and common pitfalls so you can catch production issues early.

For each PDF file, the linter reports:
MediaBox, TrimBox, and BleedBoxTrimBox == MediaBoxIt also summarizes unique page sizes it encounters (in millimeters):
MediaboxesTrimboxespdfinfo must be available on your system PATH (used via a local service wrapper)
brew install popplersudo apt-get install poppler-utilssudo dnf install poppler-utilsOption A — Using the repository script (if available on your platform):
./install # normal install
# or
./install.dev # development install (if you prefer symlinks)
Option B — Activate globally from path:
dart pub global activate --source path /path/to/dart_pdf_linter
# Make sure your pub cache bin is on PATH, e.g.:
# export PATH="$PATH:${HOME}/.pub-cache/bin"
This exposes both executables: pdf_linter and dart_pdf_linter.
pdf_linter [-R] <path>
-R — recurse into subdirectories<path> — a file or directory to scanExamples:
# Lint all PDFs in a directory (non-recursive)
pdf_linter ./assets/pdfs
# Lint all PDFs recursively
pdf_linter -R ./assets
You can use the alternative entrypoint dart_pdf_linter with the same arguments.
/path/to/file.pdf
- has no trimboxes
- has 1 empty mediaboxes
- page 3 : trimbox equals mediabox (0 0 595 842)
At the end of the run, unique sizes are summarized (stdout):
Mediaboxes:
- 210 x 297 mm
- 148 x 210 mm
Trimboxes:
- 210 x 297 mm
Note: currently the tool does not set a non-zero exit code for findings; it reports issues via stderr while exiting with code 0.
pdfinfo is installed and available on PATH..pdf extension are inspected.This project is licensed under the terms of the LICENSE file included in the repository.