Skip to main content

Crate zpl

Crate zpl 

Source
Expand description

Parse ZPL command streams and render output-independent label scenes.

render() converts ZPL bytes into a render::Document containing label scenes and rendering warnings. Options controls dimensions, resolution, and compatibility behavior; its default selects the ZD621 203-DPI profile. See render::profiles for other printer and specification profiles.

Output adapters in output encode scenes as PNG, SVG or PDF. For direct pixel access, use output::raster::rasterize. Runtime bitmap providers implement fonts::BitmapFont; decoded strike types live in bitmap_font. Bundled glyph data uses zpl-bitmap-fonts.

For command framing without rendering, use parse::ParseContext. The parser preserves unknown commands and binary payloads; successful parsing does not imply that the renderer supports the input.

use zpl::{render, Options};

let document = render(b"^XA^FO20,20^FDHello^FS^XZ", Options::default())?;
assert_eq!(document.labels.len(), 1);

Re-exports§

pub use render::render;
pub use render::Options;

Modules§

bitmap_font
Decoded bitmap strike types and validation. No serialized font format is required. Bundled fonts use the compact zpl-bitmap-fonts reader directly.
fonts
Font resources, encoding, glyph lookup and metrics, scoped to a render call. No scene construction, filesystem access or printer access.
output
Output-independent filled paths and adapters. Coordinates are printer dots.
parse
Lossless framing of complete ZPL command streams.
render
Local, deterministic ZPL previews. Unsupported rendering semantics are errors.
truetype
Bounded TrueType outline loading and hint execution for monochrome labels.
version
Version information for the linked ZPL library.