Zpl.Scene (zpl v0.3.0)

View Source

An immutable rendered label with width, height, and DPI metadata.

The native reference owns the scene independently of the document's Elixir lifetime. Metadata fields are informational: editing them does not change the native scene. References are local to the VM and cannot be persisted or sent to another node. Output limits accept maps or keyword lists.

Summary

Types

t()

@type t() :: %Zpl.Scene{
  dpi: pos_integer(),
  height: pos_integer(),
  reference: reference(),
  width: pos_integer()
}

Functions

encode(scene, format, limits \\ [])

@spec encode(t(), :png | :svg | :pdf, Zpl.config()) :: Zpl.result(binary())

Encodes one label as a PNG, SVG, or PDF binary.

encode!(scene, format, limits \\ [])

@spec encode!(t(), :png | :svg | :pdf, Zpl.config()) :: binary()

pdf(scene, limits \\ [])

@spec pdf(t(), Zpl.config()) :: Zpl.result(binary())

png(scene, limits \\ [])

@spec png(t(), Zpl.config()) :: Zpl.result(binary())

rasterize(scene, limits \\ [])

@spec rasterize(t(), Zpl.config()) :: Zpl.result(Zpl.Raster.t())

Rasterizes a label to raw grayscale bytes.

rasterize!(scene, limits \\ [])

@spec rasterize!(t(), Zpl.config()) :: Zpl.Raster.t()

svg(scene, limits \\ [])

@spec svg(t(), Zpl.config()) :: Zpl.result(binary())