Skip to content

Releases

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

Choose a tag to compare

@MartinsMessias MartinsMessias released this 05 Nov 01:33

⚡ 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.

RasgaPDF v0.4.1

Choose a tag to compare

@MartinsMessias MartinsMessias released this 03 Nov 23:58

RasgaPDF v0.4.1 — Stream-Level Sub-Character Glyph Coalescence & Dynamic Kerning

Highlights

  • Stream-Level Glyph Coalescence (ContentInterpreter::emit_text_string): Coalesces consecutive sub-character Tj + Td and TJ glyphs 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.0pt overlap bounds with proportional max_overlap = (font_size * 0.20).max(1.5) and char_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/), and AGENTS.md.

v0.4.0: Natural Reading Order (XY-Cut), Sub-Page VLM Triage & Native MCP Server

Choose a tag to compare

@MartinsMessias MartinsMessias released this 02 Nov 17:50

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 natural CLI 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_layout is flagged on SpatialBlock, SpatialChunk, and SpatialPage.
  • 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, and get_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

Choose a tag to compare

@MartinsMessias MartinsMessias released this 31 Oct 04:08

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

Choose a tag to compare

@MartinsMessias MartinsMessias released this 30 Oct 11:46

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 bundles librasgapdf.so (Linux), rasgapdf.dll (Windows), and librasgapdf.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-compilation pip install rasgapdf.
    • .NET (NuGet): Multi-runtime packaging supporting runtimes/linux-x64, runtimes/win-x64, and runtimes/osx-x64.
    • Rust (crates.io): Pure Rust ISO 32000-1 engine v0.3.2.
  • 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

Choose a tag to compare

@MartinsMessias MartinsMessias released this 30 Oct 03:18

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 /W width 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).
  • 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 /Prev chains with entry().or_insert().
    • Added width range validation and byte bounds checking in XRef stream parsing.
  • 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.

Full Changelog: v0.3.0...v0.3.1

RasgaPDF v0.3.0: 100% Pure Rust ISO 32000-1 Engine & WebAssembly Support

Choose a tag to compare

@MartinsMessias MartinsMessias released this 29 Oct 22:38

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

Choose a tag to compare

@MartinsMessias MartinsMessias released this 29 Oct 03:39

🚀 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.
  • 🐹 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

Choose a tag to compare

@MartinsMessias MartinsMessias released this 29 Oct 02:53

🚀 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

Choose a tag to compare

@MartinsMessias MartinsMessias released this 28 Oct 01:44

🚀 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.