PDFLang Documentation — English

Complete guide to the .pdfl language and the pdfl CLI — version 0.6.0.

Every example in this documentation is runnable, commented code. If you have never used the language, start with the manual (chapter 1) and use the rest as reference.

Table of contents

Chapter Contents
1. The language Full manual: checks, assertions, types, units, blocks, functions, imports, rules
2. Document types doc, page, font, image, region — all properties and methods
3. text:: Text: extraction, normalization, search, Brazilian validations, PII
4. struct:: Structure and metadata: objects, XMP, security, hashing
5. visual:: Images: resolution, visual comparison, pHash, SSIM, quality
6. prepress:: Prepress: ink coverage, separations, spot colors, fonts, boxes
7. codes:: Barcodes and QR codes: detection, decoding, validation
8. fix:: Normalization: boxes, pages, watermarks, merge/split, optimization
9. data:: External data: glossaries, datasets and lookup tables
10. Standard library List and string methods, global functions
11. CLI commands run, compare, watch, fix, inspect, lint, fmt, doc, pack, add
12. Recipes Complete cases: print shop, legal publisher, lab, CI/CD

Getting started in 30 seconds

Create my_profile.pdfl:

// Every script is a list of checks. Each check groups related validations
// and becomes a section of the report.
check "Basic structure" {
  // require: fails with a message generated from the expression itself
  require doc.page_count > 0

  // assert: fails with the message you write
  assert doc.title != "", "PDF has no title in its metadata"
}

Run it:

pdfl run my_profile.pdfl document.pdf

The report goes to stdout as JSON. The exit code tells you what happened: 0 everything passed, 1 warnings only, 2 validation errors, 3 syntax error.

Conventions used here

  • Each function is listed with its signature, what it does, what it returns and a commented example.
  • Arguments in square brackets are optional: calculate_tac([page]).
  • "1-based" means the first page is 1, not 0 — the language counts pages the way people do, not the way programmers do.
  • Measurements are always in points (1 pt = 1/72 in). Use unit literals (3mm, 1in) and conversion happens automatically.

Other languages: Português (Brasil) · Español · 日本語 · 中文 · Français · العربية · Deutsch