Repository navigation
PaperForge v1.5.1
Pure-Elixir PDF authoring, transformation, and production rendering for the BEAM — now with role-aware table styling, an optional supervised :ets shared cache with per-key singleflight coalescing, lock-free circuit breaker reads, hot-path layout/serialization optimizations, and Elixir ~> 1.19 compatibility.
Highlights
Table Styling & Schema
- Independent header typography for flow and declarative tables (
:header_font,:header_size,:header_line_height), separate axis padding (:padding_x,:padding_y), and per-cell:border_colorwhile retaining native multipage row handling and defaults. - Added typed
tableOptionsandtableCelldefinitions topriv/paperforge.schema.json.
Scalability & Runtime Hardening
- Optional supervised shared cache (
PaperForge.Cache)::ets(read_concurrency: true) with lock-free:atomicshit/miss counters and non-blocking per-key singleflight / stampede coalescing for both parsed TrueType fonts and compiled.paperforgetemplates (Declarative.compile_cached/3) across ephemeral Phoenix/Oban workers. Errors ({:error, _}) are never cached. - Public
PaperForge.Runtime.CircuitBreaker: lock-free:ets(read_concurrency: true) reads on the healthy path (0GenServercalls),start_link/1supervision support, caller-side option validation, uncaught exception tracking fortrip_on: :all, and a new[:paperforge, :circuit_breaker, :open]Telemetry event inPaperForge.Telemetry.events/0. - Runtime timeout guard: executes directly in-process when
timeout: :infinity(avoiding worker spawns and heap copies on default PDF parses) and flushes late worker messages on timeout. - Included
form_appearance_optionsinPaperForge.Document.t()and broke the Elixir 1.19 compile-time cycle betweenDocumentandLimits.
Hot-Path Performance (Controlled A/B vs 8862c05, Elixir 1.20.2 / OTP 29 / MIX_ENV=prod)
All outputs verified 100% byte-for-byte identical:
| Workload | Median Before | Median 1.5.1 |
Speedup / Change | GC Words Saved |
|---|---|---|---|---|
Pure PDF serialization (Serializer.encode/1, 9,000 objects) |
14.59 ms | 2.53 ms | 5.77x (-82.7%) | -73.7% |
| Wrapped prose table (1,500 multiline rows) | 324.59 ms | 216.00 ms | 1.50x (-33.5%) | -24.6% |
40 concurrent ephemeral jobs (c=8, .paperforge + TrueType) |
191.11 ms (209/s) | 137.03 ms (292/s) | 1.39x (-28.3%) | -23.1% |
TrueType multilingual (1,000 lines, SFNSMono.ttf) |
28.74 ms | 22.39 ms | 1.28x (-22.1%) | -28.4% |
Official large report (5,000 rows, 179 pages) |
804.56 ms | 703.99 ms | 1.14x (-12.5%) | -18.2% |
Official medium report (500 rows, 18 pages) |
49.06 ms | 45.62 ms | 1.08x (-7.0%) | -7.0% |
Reproducible via benchmarks/ab_compare.exs (full 8-workload report in BENCHMARKS.md).
Guides, Compatibility & CI
- Guides: Expanded
PHOENIX.md(send_download/3, zero-copy{:file, path}, chunked HTTP streaming, LiveViewstart_async/3, andPaperForge.Cachesupervision) andINTEROPERABILITY.md(AES-256 encrypted open + rotation + watermark + re-encryption). - Compatibility: Relaxed Elixir requirement to
~> 1.19(CI matrix covers Elixir1.19and1.20.2on OTP28.3and29.0). - Quality & Repo Hygiene:
mix credo --strictacross the entire repository (0 issues across 181 files / 2,879 mods/funs).mix docs --warnings-as-errorsenforced in CI.- Added
StreamDatadifferential property tests (TextWrapper,Serializer,WinAnsi) and byte-for-byte SHA-256 deterministic PDF regression tests (477 tests and properties passing). - Moved
mix test.fuzzto amix.exsalias so downstream projects do not inherit an internal task. - Removed 493 MB of raw campaign logs from
benchmarks/results/while retaining all benchmark summaries.
Deprecated
PaperForge.add_flow/4,PaperForge.layout_flow/4, andPaperForge.add_table/4are deprecated in favor ofPaperForge.layout/3andPaperForge.Flow.
Installation
def deps do
[
{:paper_forge, "~> 1.5"}
]
endFull Changelog: v1.5.0...v1.5.1