Expand description
Official Rust client for the LabelZoom API.
LabelZoom converts barcode labels between printer languages (ZPL, EPL, TSPL,
DPL), LabelZoom’s own XML/JSON model, PDF, and raster images. Almost everything the API does
happens at one endpoint:
POST https://api.labelzoom.com/api/v2/convert/{sourceFormat}/to/{targetFormat}Authentication is optional. Without a credential the API serves a free tier: watermarked output, the first label only, a 1 MB request cap, and no multi-page, JSON-target or image-to-image conversion.
use labelzoom::{ConversionOptions, ConvertRequest, LabelZoomClient, SourceFormat, TargetFormat};
let client = LabelZoomClient::new(); // anonymous; this works
let request = ConvertRequest::new(
SourceFormat::Zpl,
TargetFormat::Png,
"^XA^FO20,20^A0N,28^FDHello^FS^XZ",
)
.options(ConversionOptions::new().dpi(300).label_size(4.0, 6.0));
client.convert(&request)?.save("label.png")?;The behaviour of every LabelZoom SDK is specified in docs/API_CONTRACT.md and checked
by the shared fixtures in conformance/, which this crate’s test suite executes.
Structs§
- ApiError
- A non-2xx response from the LabelZoom API.
- Client
Builder - Configures a
LabelZoomClient. - Conversion
Options - The conversion parameters, in the shape the API expects.
- Conversion
Result - The outcome of a successful conversion.
- Convert
Request - One conversion.
- Http
Request - One outgoing HTTP request.
- Http
Response - One HTTP response, including a non-2xx one.
- Label
Size - The media size, in INCHES – not dots, and not millimetres.
- Label
Zoom Client - Converts labels through the LabelZoom API.
- PdfOptions
- How a PDF source is read.
- Position
- The pixel offset of the extracted region. Server default 0,0.
- Thread
Sleeper - Sleeps for real. The default.
- Transport
Error - The request never got a response: a dial failure, a timeout, a TLS error.
- Ureq
Transport - The bundled blocking backend, behind the default
ureq-transportfeature. - Validation
Error - A request rejected before it left the process.
- ZplOptions
- ZPL output settings.
Enums§
- ApiError
Kind - Which class of API error this is.
- Color
Mode - How colour is reduced when rasterizing. Server default
GRAYSCALE. - Error
- Everything a conversion can fail with.
- PdfConversion
Mode - How a PDF source is interpreted. Server default
IMAGE. - Source
Format - The format of the document being converted.
- Target
Format - The format to convert into.
- ZplImage
Compression - Encoding of images embedded in ZPL output. Server default
Z64.
Constants§
- API_
KEY_ ENV_ VAR - The environment variable consulted when no credential is configured.
- DEFAULT_
BASE_ URL - The production API host.
- VERSION
- This crate’s version, as it appears in the User-Agent.