Skip to main content

Crate ofd_rs

Crate ofd_rs 

Source
Expand description

ofd-rs — Rust library for OFD (Open Fixed-layout Document, GB/T 33190-2016).

Generate OFD documents from images. Structure follows ofdrw conventions.

§Quick Start

use ofd_rs::{OfdWriter, ImageSource};

let image_bytes = std::fs::read("photo.jpg").unwrap();
let ofd = OfdWriter::from_images(vec![
    ImageSource::auto_detect_default(image_bytes).unwrap(),
]).build().unwrap();
std::fs::write("output.ofd", ofd).unwrap();

Re-exports§

pub use model::DocInfo;
pub use model::ImageFormat;
pub use model::PageSize;
pub use model::PPM_DEFAULT;

Modules§

model
types
Basic data types defined in GB/T 33190-2016 Section 7.3.

Structs§

ImageSource
Source for a single image page to be embedded in the OFD.
OfdWriter
OFD document writer.

Enums§

OfdError
Errors that can occur during OFD generation.