Skip to content

v0.4.2 - ISO 32000-2:2020 (PDF 2.0) Compliance & Metadata Standardization

Latest

Choose a tag to compare

@MartinsMessias MartinsMessias released this 05 Nov 01:33
· 3 commits to main since this release

⚡ RasgaPDF v0.4.2 — Full ISO 32000-2:2020 (PDF 2.0) Compliance & Metadata Standardization

This release upgrades the pure-Rust spatial PDF engine (src/engine/) to full compliance with ISO 32000-2:2020 (PDF 2.0 — Current Edition) alongside ISO 32000-1:2008 (PDF 1.7), with zero external C dependencies and zero regressions.

🚀 Highlights & New Features

  1. Accessibility & /ActualText Replacement (BDC / BMC / EMC — ISO 32000-2:2020 §14.9.4):
    • Tracks marked-content property dictionaries in ContentInterpreter (src/engine/content.rs).
    • When /Span << /ActualText (...) >> BDC ... EMC wraps custom ligatures, PUA glyphs, or accessibility replacements, RasgaPDF substitutes the /ActualText string while preserving the exact physical bounding box and coalescing mid-word spans seamlessly.
  2. UTF-8 (0xEF 0xBB 0xBF) & UTF-16BE (0xFE 0xFF) Text Strings (ISO 32000-2:2020 §7.9.2.2):
    • Native support for 3-byte UTF-8 BOM strings introduced in PDF 2.0 as well as 2-byte UTF-16BE BOM strings across /ActualText and /ToUnicode CMap beginbfchar / beginbfrange mappings (src/engine/font.rs).
  3. Hybrid Cross-Reference /XRefStm Support (ISO 32000-2:2020 §7.5.8.4):
    • Resolves supplemental /XRefStm binary cross-reference streams referenced from classic ASCII trailer dictionaries (src/engine/xref.rs), unlocking compressed object streams (/Type /ObjStm) in hybrid-reference PDFs.
  4. Font /Encoding Dictionaries with /Differences & MacRomanEncoding (ISO 32000-2:2020 §9.6.5):
    • Parses /Encoding dictionaries (<< /BaseEncoding ... /Differences [ code /glyphname ... ] >>) and named encodings (/MacRomanEncoding, /WinAnsiEncoding), mapping Adobe Glyph List (AGL) names, ligatures (/fi, /fl, /ff, /ffi, /ffl), accented Latin glyphs, and /uniXXXX / /uXXXX hex glyph names (src/engine/font.rs, src/engine/doc.rs).
  5. Complete Text State Operators (Tc, Tw, Tz, " — ISO 32000-2:2020 §9.3–9.4):
    • Implements character spacing (Tc), word spacing (Tw), horizontal scaling (Tz), and the quote-and-spacing operator (") in glyph advance and TJ kerning calculations (src/engine/content.rs).
  6. Deterministic /Encrypt Trailer Detection (ISO 32000-2:2020 §7.6):
    • Detects /Encrypt dictionaries in the PDF trailer and returns an explicit, deterministic error instead of attempting to parse encrypted byte streams (src/engine/doc.rs).
  7. License Metadata Standardization (PEP 639 & SPDX):
    • Reconciled package metadata across PyPI, Crates.io, and npm. PyPI now embeds standard License-Expression: AGPL-3.0-or-later and bundled license files, eliminating discrepancies across package indexers.