Repository navigation
Releases
v0.4.2 - ISO 32000-2:2020 (PDF 2.0) Compliance & Metadata Standardization
⚡ 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
- Accessibility &
/ActualTextReplacement (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 ... EMCwraps custom ligatures, PUA glyphs, or accessibility replacements, RasgaPDF substitutes the/ActualTextstring while preserving the exact physical bounding box and coalescing mid-word spans seamlessly.
- Tracks marked-content property dictionaries in
- 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
/ActualTextand/ToUnicodeCMapbeginbfchar/beginbfrangemappings (src/engine/font.rs).
- Native support for 3-byte UTF-8 BOM strings introduced in PDF 2.0 as well as 2-byte UTF-16BE BOM strings across
- Hybrid Cross-Reference
/XRefStmSupport (ISO 32000-2:2020 §7.5.8.4):- Resolves supplemental
/XRefStmbinary cross-reference streams referenced from classic ASCIItrailerdictionaries (src/engine/xref.rs), unlocking compressed object streams (/Type /ObjStm) in hybrid-reference PDFs.
- Resolves supplemental
- Font
/EncodingDictionaries with/Differences&MacRomanEncoding(ISO 32000-2:2020 §9.6.5):- Parses
/Encodingdictionaries (<< /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//uXXXXhex glyph names (src/engine/font.rs,src/engine/doc.rs).
- Parses
- 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 andTJkerning calculations (src/engine/content.rs).
- Implements character spacing (
- Deterministic
/EncryptTrailer Detection (ISO 32000-2:2020 §7.6):- Detects
/Encryptdictionaries in the PDF trailer and returns an explicit, deterministic error instead of attempting to parse encrypted byte streams (src/engine/doc.rs).
- Detects
- 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-laterand bundled license files, eliminating discrepancies across package indexers.
- Reconciled package metadata across PyPI, Crates.io, and npm. PyPI now embeds standard
RasgaPDF v0.4.1
RasgaPDF v0.4.1 — Stream-Level Sub-Character Glyph Coalescence & Dynamic Kerning
Highlights
- Stream-Level Glyph Coalescence (
ContentInterpreter::emit_text_string): Coalesces consecutive sub-characterTj+TdandTJglyphs on the same baseline directly at interpretation time, reducing span allocations by 81%+ and speeding up parsing on glyph-by-glyph PDFs (e.g. Cairo, Skia, Chromium, airline tickets, DANFEs). - Dynamic Proportional Kerning & Intra-Word Thresholds (
doc.rs&content.rs): Replaces fixed-1.0ptoverlap bounds with proportionalmax_overlap = (font_size * 0.20).max(1.5)andchar_spacing_limit = (font_size * 0.09).clamp(0.4, 1.35), eliminating split headings/words in 14pt–22pt fonts (such as"LA T AM"->"LATAM","T ermos"->"Termos","Car tão"->"Cartão"). - Horizontal Gap Validation in
extract_text_bytes(spatial.rs): Prevents false inter-letter spaces when extracting plain text from character-by-character PDF streams. - Full Multi-Platform Sync: Synchronized across Rust (
crates.io), Python (PyPI), Node.js (npm), C# (NuGet), Go (bindings/go/v0.4.1), WebAssembly (docs/&space_hf/), andAGENTS.md.
v0.4.0: Natural Reading Order (XY-Cut), Sub-Page VLM Triage & Native MCP Server
What's Changed in v0.4.0
1. 📖 Natural Reading Order via Recursive XY-Cut
- Implemented the deterministic Recursive XY-Cut algorithm in pure Rust (
src/engine/doc.rs). - Automatically cuts horizontal whitespace bands (Y-cut) for paragraphs and vertical whitespace gutters (X-cut >= 16.0 pt) for multi-column documents and sidebars.
- Resolves the multi-column interleaving defect without external C/C++ dependencies.
- Configurable via
ParserOptions.reading_order: "natural"(default) or--reading-order naturalCLI flag.
2. 👁️ Sub-Page VLM Triage (is_complex_layout & complexity_score)
- Geometric complexity metric S(R) in [0.0, 1.0] based on vector drawing overlap, span collisions, and borderless tabular grid fragmentation.
- When S(R) >= 0.45,
is_complex_layoutis flagged onSpatialBlock,SpatialChunk, andSpatialPage. - Enables AI agents to crop and triage only ambiguous sub-page bounding boxes to Vision-Language Models (VLMs), saving 80%+ image tokens.
- Cross-platform models updated in Go (
bindings/go/rasgapdf.go) and C# (bindings/csharp/RasgaPdf.cs).
3. 🔌 Native Model Context Protocol (MCP) Server (rasgapdf mcp)
- Built-in zero-dependency stdio JSON-RPC 2.0 MCP server for seamless integration with Claude Desktop, Cursor, Antigravity, and AI agents.
- 4 native tools exposed:
parse_pdf,search_document,get_chunks, andget_triage.
4. 📚 Comprehensive Documentation & Self-Updating Directive
- Added Section 8 to
AGENTS.md: Autonomous Self-Updating Documentation Directive. - Synchronized
README.md,docs/SCHEMA.md,llms.txt,llms-full.txt, and WebAssembly binaries.
v0.3.3: Coordinate Contract Normalization, Spatial RAG Chunking & Agents Playbook
What's New in v0.3.3:
- 📐 Deterministic Coordinate Contract: CropBox precedence (ISO 32000-1 §14.11.2) over MediaBox with automatic parent inheritance, non-zero origin offset normalization to Top-Left (0, 0), and explicit rotation awareness.
- 🔄 Post-Rotation Transformations: Added \�pply_rotation: bool\ option and .with_applied_rotation()\ / \page.rotated()\ for direct alignment with rotated canvases (90°, 180°, 270°).
- 🧩 Spatial RAG Chunking: Native \ o_spatial_chunks()\ and \SpatialChunk\ model preserving full arrays of constituent bounding boxes (\�boxes: Vec) for dense retrieval without sacrificing multi-quad highlight accuracy.
- 🦜️ LangChain Mode 'chunks': Integrated \mode='chunks'\ in \RasgaPDFLoader.
- 🤖 AGENTS.md Playbook: Added comprehensive developer & AI agent guidelines.
- 🌐 WebAssembly & Multi-Platform Native Matrix: Updated WASM bundle and multi-platform native libraries across Linux, Windows, and macOS.
RasgaPDF v0.3.2: Multi-Platform Matrix (Linux, Windows, macOS) for npm, PyPI & NuGet
RasgaPDF v0.3.2 introduces full multi-platform native pre-compiled binaries across Linux, Windows, and macOS for all package registries (npm, PyPI, and NuGet).
🎯 Key Enhancements in v0.3.2:
-
Multi-Platform Matrix Build Pipeline (
Linux,Windows,macOS):- Node.js (
npm): Package now bundleslibrasgapdf.so(Linux),rasgapdf.dll(Windows), andlibrasgapdf.dylib(macOS). Out-of-the-box native FFI speed on all three major OS platforms without requiring local Rust/C build toolchains. - Python (
PyPI): Pre-compiled native libraries for Windows, Linux, and macOS bundled in wheels for instant zero-compilationpip install rasgapdf. - .NET (
NuGet): Multi-runtime packaging supportingruntimes/linux-x64,runtimes/win-x64, andruntimes/osx-x64. - Rust (
crates.io): Pure Rust ISO 32000-1 enginev0.3.2.
- Node.js (
-
Comprehensive Security & Hardening:
- Full DoS resilience (bounded recursion depth, bounded 128 MB Flate decompression stream limits, and capped graphics state stacks).
- WebAssembly allocator soundness (
Layout::from_size_align). - NUL byte sanitization on FFI string marshalling.
- Full Diátaxis documentation architecture with zero broken links.
Full Changelog: v0.3.1...v0.3.2
RasgaPDF v0.3.1: CID Font Metrics, NF-e Layout Fixes & Multi-Platform Documentation
RasgaPDF v0.3.1 brings critical font metric precision improvements for Type0 / Identity-H CID fonts, Brazilian NF-e layout stabilization, multi-ecosystem documentation refinement, and repository hardening.
🎯 Highlights in v0.3.1:
-
CID Font Metrics & Precise Bounding Boxes:
- Direct parsing of
/DescendantFonts,/DW(Default Width), and/Wwidth arrays in Type0 / Identity-H composite fonts according to ISO 32000-1 §9.7.4. - Eliminates text clipping in preview bounding boxes for embedded TrueType/OpenType fonts (e.g.
ArialUnicodeMS,Calibri,SegoeUI).
- Direct parsing of
-
NF-e & Small Typography Layout Extraction:
- Adaptive word clustering threshold for dense invoice text (6pt–8pt fonts), preventing word amalgamation in Brazilian NF-e invoices and technical specifications.
- Improved multi-line span coalescing in table detection to distinguish true data tables from multi-column textual paragraphs.
-
Incremental Update & XRef Resilience:
- Preserved newest object versions when traversing backward cross-reference
/Prevchains withentry().or_insert(). - Added width range validation and byte bounds checking in XRef stream parsing.
- Preserved newest object versions when traversing backward cross-reference
-
Windows-1252 & Typographic Quote Normalization:
- Comprehensive character mapping for 0x80–0x9F code points (typographic en-dashes, em-dashes, curly quotes, bullet points).
-
Multi-Platform Ecosystem Documentation & Badges:
- Dedicated NuGet README (
bindings/csharp/README.md) preventing raw metadata leaking on NuGet.org. - Dedicated Go README (
bindings/go/README.md). - Added live download counter badges for PyPI, npm, Crates.io, and NuGet (>4,000 total downloads across registries).
- Clarified Pure Rust ISO 32000-1 architecture and separated English & Portuguese FAQs.
- Dedicated NuGet README (
Full Changelog: v0.3.0...v0.3.1
RasgaPDF v0.3.0: 100% Pure Rust ISO 32000-1 Engine & WebAssembly Support
RasgaPDF v0.3.0 represents a major architectural milestone: complete elimination of the mupdf C-dependency and its heavyweight build toolchain requirements (C/C++ compilers, MSBuild), replacing it with an internal, pure Rust PDF engine built directly from the ISO 32000-1 specification.
Key Highlights and Architectural Changes:
-
100% Pure Rust ISO 32000-1 Engine (src/engine/):
- Custom memory-safe parser, lexer, xref cross-reference table resolver, and zlib/flate decompressor.
- Zero C/C++ toolchain requirements during build (cargo build works out of the box).
- Cross-compilation to any platform (Linux, Windows, macOS, Musl, WASM) without native link errors.
-
WebAssembly Browser Playground:
- Compiled pure Rust engine to WebAssembly (rasgapdf.wasm).
- Full client-side PDF parsing and 2D spatial layout directly in the browser with ~8 ms latency.
-
Spatial 2D Geometry and Typography:
- Adobe Core 14 AFM (Helvetica, Times, Courier) font metric tables for sub-millimeter bounding box precision.
- Recursive Form XObject parsing and robust CMap / /ToUnicode glyph stream decoding.
- Automatic filtering of phantom whitespace/non-breaking space spans (\u00A0).
-
Direct In-Memory Image Extraction:
- Extraction of embedded raster image streams (JPEG DCTDecode, PNG FlateDecode, MIME) directly into byte arrays with SHA-256 content hashing.
-
2D Vector Path Recognition:
- Full path operator parsing (re, m, l, c, v, y, h, f, S) for drawing, separator lines, and chart analysis.
-
Supply Chain and Security Hardening:
- Neutralized third-party vulnerabilities (python-multipart >= 0.0.22).
- Strict Token Permissions, zero binary artifacts in git tree, and 100% passing automated CI suites.
-
Multi-Ecosystem Parity:
- Python (PyPI): Pure wheel + native FFI with LangChain (RasgaPDFLoader) and LlamaIndex (RasgaPDFReader) support.
- Node.js (npm): Hardened Koffi FFI binding without shell/environment variable accesses.
- .NET (NuGet): Multi-platform runtime packaging (win-x64, linux-x64).
- Go: Module path github.com/MartinsMessias/rasgapdf/bindings/go aligned with v0.3.0 C-ABI.
Full Changelog: v0.2.6...v0.3.0
v0.2.6: Socket.dev Security Hardening, Multi-Platform NuGet Packaging & Go Modules
🚀 What's New in v0.2.6
- 🛡️ Socket.dev Supply Chain Hardening (Node.js):
- Completely eliminated \child_process\ (\execFileSync) and \process.env.HOME\ accesses in \�indings/nodejs/index.js.
- Upgraded \koffi\ to full dependency with deterministic pointer decoding and memory freeing (\koffi.decode\ + \reeString).
- Resolves \shell\ and \environmentVariable\ alerts on Socket.dev.
- 🔷 Multi-Platform NuGet Package (.NET):
- Configured \RasgaPdf.csproj\ to bundle multi-platform native runtimes (
untimes/win-x64/native\ and
untimes/linux-x64/native) and full package README. - Added automated NuGet publishing pipeline via Trusted Publishing (OIDC) and API key support.
- Configured \RasgaPdf.csproj\ to bundle multi-platform native runtimes (
- 🐹 Official Go Modules Alignment:
- Corrected module import path to \github.com/MartinsMessias/rasgapdf/bindings/go.
- Official subdirectory tagging (\�indings/go/v0.2.6) enabling direct indexing on pkg.go.dev.
- 📦 Multi-Registry Synchronization:
- PyPI, npm, crates.io, NuGet, and Hugging Face all aligned to v0.2.6.
v0.2.5: Native Typography Engine (Ligatures & De-hyphenation) & Hardened Security
🚀 What's New in v0.2.5
- 🔤 Native Unicode Ligatures Decomposition: Automatic zero-overhead normalization of typographic ligatures (fi, fl, ff, ffi, ffl, ft, st) directly in the Rust extraction core (\extract_text_bytes), boosting RAG search recall and tokenization accuracy.
- ✂️ Native Inter-line De-hyphenation: Smart detection and joining of hyphenated words split across line breaks, preventing corrupted word embeddings in downstream LLMs.
- 📊 Benchmark Supremacy (94.83% Accuracy): Verified across 14 scientific papers (425 pages) in the official benchmark suite, beating PyMuPDF (94.23%) across 100% of documents and outperforming Google PDFium on dense papers.
- 🛡️ Hardened Supply-Chain & Zero-Vulnerability Security:
- Resolved 40 Code Scanning alerts (80% drop), reaching 0 CodeQL SAST alerts and 0 loose binary artifacts.
- Subresource Integrity (SRI) hashes applied to all third-party CDNs.
- Pre-push validation hook for local checks.
- Lean and cost-optimized publishing pipeline.
v0.2.4: Official LangChain & LlamaIndex Spatial RAG Integrations
🚀 What's New in v0.2.4
- 🦜️ Official LangChain Document Loader (RasgaPDFLoader): Native out-of-the-box loader with 'pages', 'elements' (spatial RAG with bounding boxes), and 'text' modes, plus automatic markdown table reconstruction.
- 🦙 Official LlamaIndex Reader (RasgaPDFReader): Full integration with LlamaIndex BaseReader protocol for lightning-fast vector indexing.
- 💼 Commercial & Enterprise Licensing: Dual-licensing option for closed-source and proprietary enterprise deployments.
- 🧹 Architecture Cleanup: Removed legacy prototype files, upgraded CI workflows to Node 22 (LTS), and added 25 automated spatial RAG test cases.
- 🛡️ Cryptographic Provenance: Published with PyPI OIDC attestations, npm Sigstore provenance, and crates.io security.