rust-pptx 0.1.3

Parse PowerPoint PPTX and legacy PPT presentations into a structured model
Documentation
# rust-pptx

by Extend

Parse PowerPoint presentations from bytes. The parser detects OOXML presentations and legacy PowerPoint binary presentations and returns a structured model of slides, shapes, text, charts, and embedded assets. Input size, entry size, and total expanded size are unlimited by default, subject to available memory. Entry-count and XML-complexity limits remain enabled; callers can configure size limits through `ParseLimits`.

Install with `cargo add rust-pptx`. The Rust library target is named `rust_pptx`.

```rust
use rust_pptx::{parse_presentation, ParseError, ParseLimits, PresentationDocument};

fn parse(bytes: &[u8]) -> Result<PresentationDocument, ParseError> {
    parse_presentation(bytes, &ParseLimits::default())
}
```

The WebAssembly bindings are available as `rust-pptx-wasm`.

Use `parse_presentation_with_options(&bytes, &ParseLimits::default(), &ParseOptions { include_3d_models: true })` to include original embedded 3D models. Image nodes then expose `model3d`, containing the model asset bytes, part name, content type, relationship IDs, optional preview metadata and source XML preserving camera, transform and lighting settings. The saved 2D preview remains the image's `assetId`. Missing previews do not discard the model asset. The option defaults to `false`: `parse_presentation` omits `model3d` and 3D model payloads from the asset map. This does not decode meshes or render new camera views.

Picture and shape paint is produced by `rust-office-art` when supported. Image nodes keep their original `assetId` and `sourceXml` alongside optional `pictureSvg`; shape nodes expose optional `shapeSvg`. Both can include `paintBounds`, measured in CSS pixels relative to the unrotated layout frame. Group resizing determines the paint frame before local rotation. Zero-axis connectors use a one-pixel paint layout basis while retaining zero in their source transform. The SVG already contains local rotation, flips, clipping and effects. Consumers should position it using the paint bounds without applying those operations twice. Shape text remains structured so viewers can lay it out separately. Themes retain `formatSchemeXml` for inspecting styles that are not fully represented by the simplified model.

Charts use `rust-office-charts` with extended chart support and retain chart XML, companion styles and cached series. An unavailable shared chart SVG is reported explicitly so a consumer can choose its source or cached-data fallback.

SmartArt uses the shared bounded data-model and cached-drawing readers. Cached shapes, connectors, pictures and nested groups retain drawing order and authoritative saved text; absent or empty cached text bodies stay empty. Diagram relationships are resolved against their owning parts. Independent text-frame offsets, extents, rotation and flips are exposed separately from the shape transform for the viewer to render; incomplete frames produce a warning and use the shape frame. When a cached drawing is absent, the parser emits a clearly marked semantic layout fallback; this does not reproduce the original SmartArt layout algorithm. The [coverage report](../../docs/smartart-coverage.md) distinguishes the tested layout families from native pixel parity.

Coverage is bounded by the shared renderers. Unsupported picture and shape appearances retain source XML and structured fallback properties with warnings. General 3D rendering, arbitrary effect graphs, unsupported codecs, and regeneration of every SmartArt layout remain outside this implementation. This is not a claim of universal PowerPoint visual parity.