Skip to content

About

πŸ¦€ Fast CLI to inspect PDF metadata, fonts, color modes, and PDF/X-4 print compliance β€” built in Rust

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

pdf-inspect

A command-line tool for inspecting PDF files. Built with Rust.

Features

  • Metadata β€” Title, author, creator, creation/modification dates (human-readable)
  • Page info β€” Page count and first page dimensions (in cm)
  • Color modes β€” Detects RGB, CMYK, Grayscale, ICC profiles, spot colors
  • Embedded fonts β€” Lists all fonts with type and embedding status
  • Print profile β€” Shows output intents (standard, condition, registry)
  • PDF/X-4 compliance β€” Validates against ISO 15930-7 requirements

Installation

Quick install

curl -fsSL https://raw.githubusercontent.com/necessarylion/pdf-inspect/main/install.sh | bash

Download pre-built binary

Go to the Releases page and download the archive for your platform:

Platform File
Linux (x86_64) pdf-inspect-x86_64-unknown-linux-gnu.tar.gz
Linux (ARM64) pdf-inspect-aarch64-unknown-linux-gnu.tar.gz
macOS (Intel) pdf-inspect-x86_64-apple-darwin.tar.gz
macOS (Apple Silicon) pdf-inspect-aarch64-apple-darwin.tar.gz
Windows (x86_64) pdf-inspect-x86_64-pc-windows-msvc.zip

Then extract and move the binary to your PATH:

# macOS / Linux
tar xzf pdf-inspect-*.tar.gz
sudo mv pdf-inspect /usr/local/bin/

Build from source

git clone <repo-url>
cd pdf-inspect
cargo build --release

The binary will be at target/release/pdf-inspect.

Usage

Basic inspection

pdf-inspect document.pdf

Output:

Metadata
  Title: My Document
  Author: John Doe
  CreationDate: 13 March 2026 03:49:34 PM UTC+07:00
  Producer: Adobe PDF Library 17.0
  Trapped: False

Pages
  Count: 12
  Size: 21.00 x 29.70 cm

Color Modes
  - CMYK

Embedded Fonts
  - Arial-BoldMT (TrueType) [embedded]
  - TimesNewRomanPSMT (Type1) [embedded]

Print Profile
  Standard: GTS_PDFX
  Output condition: FOGRA39
  Description: Offset commercial and specialty printing
  Registry: http://www.color.org

JSON output

pdf-inspect document.pdf --json
pdf-inspect document.pdf --check-pdfx4 --json

PDF/X-4 compliance check

pdf-inspect document.pdf --check-pdfx4

Validates 12 requirements:

Check Requirement
PDF Version Must be 1.6 or higher
No Encryption Encryption is prohibited
Output Intent GTS_PDFX must be present
Fonts Embedded All fonts must be embedded
TrimBox/ArtBox Must be present on all pages
Color Consistency No mixing of CMYK and RGB
Trapped Key Must be set to True or False
Title Must be present and non-empty
Creator Must be present and non-empty
CreationDate Must be set
ModDate Must be set
GTS_PDFXVersion Must contain "PDF/X-4"

Development

# Run during development
cargo run -- document.pdf
cargo run -- document.pdf --json
cargo run -- document.pdf --check-pdfx4 --json

# Build release binary
cargo build --release

Project Structure

src/
β”œβ”€β”€ main.rs                        # Composition root
β”œβ”€β”€ domain/
β”‚   β”œβ”€β”€ model.rs                   # Value objects (PdfReport, ColorMode, Font, etc.)
β”‚   └── repository.rs              # PdfRepository trait
β”œβ”€β”€ infrastructure/
β”‚   └── lopdf_reader.rs            # PDF parsing with lopdf
β”œβ”€β”€ application/
β”‚   └── inspect.rs                 # Use case + PDF/X-4 validation
└── presentation/
    β”œβ”€β”€ cli.rs                     # CLI argument parsing (clap)
    └── formatter.rs               # Colored terminal output

Dependencies

License

MIT

About

πŸ¦€ Fast CLI to inspect PDF metadata, fonts, color modes, and PDF/X-4 print compliance β€” built in Rust

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages