oxideav-pdf
Pure-Rust PDF writer for the oxideav framework. Round 1 emits a
single-page PDF 1.4 document from a vector-graphics
VectorFrame — paths stay paths, fills
stay fills, no rasterisation along the way. Zero C dependencies.
Part of the oxideav
framework — a 100% pure Rust media stack. No C libraries, no FFI
wrappers, no *-sys crates.
What round 1 supports
- Paths:
MoveTo(m),LineTo(l),CubicCurveTo(c),QuadCurveTo(lifted to cubic via the2/3 * (control - endpoint)trick),ArcTo(flattened to cubic per SVG 1.1 Appendix F.6.5),Close(h). - Fills:
Paint::Solid(DeviceRGBsc),Paint::LinearGradient(axial pattern shading,Pattern Type 2+Function Type 2),Paint::RadialGradient(radial shading,Function Type 3). - Strokes: width (
w), cap (J), join (j), miter limit (M), dash pattern (d). - Transforms: every
Group::transformemits onecmoperator. - Groups:
q ... Qsave/restore brackets around children. Group opacity becomes anExtGStateresource referenced via/GSx gs. - Clip paths: emitted before the children's content stream as
W n(orW* nfor even-odd fill rule). - Fill rules:
NonZero(f/B) vs.EvenOdd(f*/B*). - Embedded raster:
ImageRefwhose underlyingVideoFrameis RGBA8 lands as a FlateDecodeImageXObject and is painted withDo.
Round-2 deferrals
- Text (waiting on
Node::Text; will use Type 0 fonts with a CIDFont built viaoxideav-ttf/oxideav-otf). - JPEG passthrough on
ImageRef(DCTDecode XObject). - Multi-page documents.
- Transparency groups beyond a per-
Group/ca+/CAopacity. - PDF reading (this crate is write-only by design — a parser would be
a separate
oxideav-pdf-parsecrate).
Usage
[]
= "0.1"
= "0.0"
use ;
use TimeBase;
let mut p = new;
p.move_to
.line_to
.line_to
.line_to
.close;
let frame = VectorFrame ;
let pdf = write_pdf.expect;
write.unwrap;
# Ok::
License
MIT — see LICENSE.