Skip to content

lmpdf: Project Tracking Issue #14

@tlkahn

Description

@tlkahn

lmpdf Project Tracker

A modern, safe Rust wrapper around Pdfium with macro-generated bindings, arena-based ownership, and honest threading.

Spec: doc/spec/lmpdf-spec.md
Roadmap: doc/roadmap.md
Design critique: doc/ideation/pdfium-render-critique-and-rewrite.md

Milestones

🔨 Infrastructure (Phases 0–2)

🚀 MVP — publish 0.1 (Phase 3)

📦 Core Features (Phases 4–7, after MVP)

⚡ Platform & Performance (Phases 8–10, after MVP)

🏁 Completion (Phases 11–12)

Dependency Graph

Phase 0 ─── Phase 1 ─── Phase 2 ─── Phase 3 (MVP / publish 0.1)
                                        │
                                        ▼
                                   #20 (coord conversion)
                                        │
                         ┌──────────────┼──────────────┐
                         ▼              ▼              ▼
                      Phase 4       Phase 5        Phase 8
                      (text)       (objects)       (pool)
                         │              │
                         └──────┬───────┘
                                ▼
                            Phase 6
                           (creation)
                                │
                                ▼
                            Phase 7
                         (annotations)
                                │
                    ┌───────────┼───────────┐
                    ▼           ▼           ▼
                Phase 9     Phase 10    Phase 11
               (bundle)     (WASM)     (coverage)
                    │           │           │
                    └───────────┼───────────┘
                                ▼
                            Phase 12
                             (1.0)

Key Design Decisions

Decision Choice
API scope Full Pdfium coverage
WASM First-class from day one
Async Sync only (callers spawn_blocking)
Linking Dynamic + Static + System + Bundled
Pdfium versions Latest + 2 prior (3 versions)
Crate layout Workspace: lmpdf-sys, lmpdf, lmpdf-bundle
Image crate Latest only, optional feature
Ownership Arena + generational handles (slotmap)
Threading !Send types + built-in PdfiumPool

Reference Implementation

pdfium-render (v0.9.1) is the primary reference. Use it for:

  • Test PDFs: 22 test fixtures in test/ — copy into lmpdf's test directory
  • FFI signatures: src/bindings.rs (519 methods) is the most complete Rust-typed Pdfium FFI catalog; cross-reference when writing pdfium_ffi! declarations
  • Pdfium C headers: Copy include/pdfium_{7763,7543,7350}/ rather than sourcing independently
  • Implementation patterns: RenderConfig builder, pixel format conversion (src/utils.rs), WASM JS dispatcher, content regeneration strategy
  • Known pitfalls: Drop ordering segfault (form before document), UTF-16LE encoding, null handle gaps, FPDFPageObj_Destroy double-free, bitmap stride alignment
  • Examples as spec: 29 examples in examples/ serve as informal feature specification — port key ones per phase (see spec Appendix A)

Full details in the spec's Appendix A: Reference Implementation.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions