All skills
Agent Workflow
PDF Vector Engine
Ultimate zero-distortion PDF engine for vector-preserving stream compression into exact target byte windows (e.g. 1.8-2.0 MB for RBI/statutory portals), lossless PDF merging, page transformations, and high-fidelity rendering without text degradation under 1000% zoom. Use whenever compressing, resizing, merging, or converting PDFs where legal readability, vector sharpness, or strict size budgets are required.
What this skill adds
A production-grade, ISO 32000-compliant engine for zero-distortion vector PDF stream compression, byte-calibrated targeting, lossless merging, page geometry transformations, and mathematical verification.
Core Directives & Guarantees
- **The Sovereign Invariant (Zero Vector Degradation)**:
- - When zoomed in to 400%–1000% in Adobe Acrobat or any standard PDF viewer, all text characters, numerical bank figures, reference IDs, and legal citations MUST remain mathematically sharp and undistorted.
- - **Strict Ban on Destructive Text Rasterization**: Never convert substantive text pages into lossy low-DPI JPEG/PNG rasters. Rasterization blurs micro-text, collapses serifs, causes anti-aliasing color halos, and leads to immediate rejection by statutory compliance portals (such as the RBI Ombudsman).
- **Coordinate Geometry Preservation**:
- - Skia and Chrome print-to-PDF engines decompose glyphs into vector Bézier curve operators (m, l, c, v, y, re).
- - **Never round coordinates to integers**. Integer rounding destroys glyph counter-loops (turning zeros and o glyphs into jagged blobs) and distorts thin stroke weights.
Architecture & Workflow
- ### 1. Root Cause of PDF Bloat
- Standard print drivers (Chrome/Skia, Microsoft Print to PDF) often decompose text glyphs into millions of Bézier curve operators with verbose 6-decimal-place ASCII floats (e.g., 44.490002 100.760002 m 44.529999 100.820000 l ...). The uncompressed content streams often exceed 60 MB per document, which standard Flate compression can only reduce to 8–14 MB.
- ### 2. Dual-Layer Hybrid Compression Pipeline
- text
- Input PDF
- ├── Page Classification
Bundled CLI Tools
- The skill provides production-tested Python scripts under scripts/:
- ### 1. Vector Compression (scripts/compress.py)
- Compresses PDF files or whole directories to target size limits while strictly preserving vector text.
- bash
- python scripts/compress.py --input document.pdf --output compressed/document.pdf --max-size-mb 2.0 --min-size-mb 1.8
- Arguments:
Reference Guides
- For in-depth mathematical derivations and specifications, consult:
- references/iso32000_stream_spec.md: ISO 32000 stream tokenization, operators, and cross-reference structures.
- references/vector_quantization_math.md: Mathematical proofs of sub-pixel quantization tolerances and serif stability.
- references/dual_layer_architecture.md: Classification heuristics for substantive vs. diagnostic document pages.
Default agent prompt
Use $pdf-vector-engine to compress, merge, or transform this PDF document into the required target size window without degrading vector text quality or glyph sharpness under extreme zoom.