pub struct ConversionOptions {Show 13 fields
pub dpi: Option<i64>,
pub rotation: Option<i64>,
pub scaling: Option<f64>,
pub color_mode: Option<ColorMode>,
pub darkness: Option<i64>,
pub position: Option<Position>,
pub watermark: Option<bool>,
pub dialect: Option<String>,
pub data: Option<Vec<Value>>,
pub label: Option<LabelSize>,
pub pdf: Option<PdfOptions>,
pub zpl: Option<ZplOptions>,
pub extra: Map<String, Value>,
}Expand description
The conversion parameters, in the shape the API expects.
Every field is an Option and only the ones you set are sent – skip_serializing_if
is rule C1 expressed in the type system. The SDK never fills in a client-side default,
so a change to a server default reaches you without a crate upgrade. Setting nothing at
all produces a bare URL with no query string.
Fields§
§dpi: Option<i64>Output resolution. Server default 203.
rotation: Option<i64>Degrees clockwise. Must be a multiple of 90. Server default 0.
scaling: Option<f64>Percentage. Server default 100.
color_mode: Option<ColorMode>Colour reduction. Server default GRAYSCALE.
darkness: Option<i64>Luminance threshold from 0 to 100. Server default 70.
position: Option<Position>Pixel offset of the extracted region.
watermark: Option<bool>Forced on for the anonymous free tier regardless of what you set.
dialect: Option<String>A printer dialect, e.g. "moca". Requires a paid license.
data: Option<Vec<Value>>The variable-field values, one entry per output label.
Typed as Vec<Value> rather than Vec<Map<String, Value>> so that a non-object
element is expressible and can be rejected with a ValidationError – which is
what lets this crate run validation/data-element-not-an-object rather than
declaring it away. Use ConversionOptions::with_data to build it from records.
label: Option<LabelSize>The media size, in INCHES. Leave None to have the server detect it.
pdf: Option<PdfOptions>How a PDF source is read.
zpl: Option<ZplOptions>ZPL output settings.
extra: Map<String, Value>Anything this crate does not model yet. Unknown keys are ignored server-side, so this is a safe forward-compatibility escape hatch. Merged at the top level of the params object.
Implementations§
Source§impl ConversionOptions
impl ConversionOptions
Sourcepub fn rotation(self, degrees: i64) -> Self
pub fn rotation(self, degrees: i64) -> Self
Sets the rotation, in degrees clockwise. Must be a multiple of 90.
Sourcepub fn color_mode(self, mode: ColorMode) -> Self
pub fn color_mode(self, mode: ColorMode) -> Self
Sets the colour mode.
Sourcepub fn watermark(self, watermark: bool) -> Self
pub fn watermark(self, watermark: bool) -> Self
Turns the watermark on or off. An explicit false is sent.
Sourcepub fn dialect(self, dialect: impl Into<String>) -> Self
pub fn dialect(self, dialect: impl Into<String>) -> Self
Sets the printer dialect. Requires a paid license.
Sourcepub fn label_size(self, width_inches: f64, height_inches: f64) -> Self
pub fn label_size(self, width_inches: f64, height_inches: f64) -> Self
Sets the media size, in inches.
Sourcepub fn pdf_conversion_mode(self, mode: PdfConversionMode) -> Self
pub fn pdf_conversion_mode(self, mode: PdfConversionMode) -> Self
Sets how a PDF source is read.
Sourcepub fn pdf_page(self, zero_based_page_number: i64) -> Self
pub fn pdf_page(self, zero_based_page_number: i64) -> Self
Selects a single PDF page. Zero-based; omit to convert every page.
Sourcepub fn zpl_commands_to_ignore<I, S>(self, commands: I) -> Self
pub fn zpl_commands_to_ignore<I, S>(self, commands: I) -> Self
Drops the named commands from ZPL output.
Sourcepub fn zpl_image_compression(self, compression: ZplImageCompression) -> Self
pub fn zpl_image_compression(self, compression: ZplImageCompression) -> Self
Sets the encoding of images embedded in ZPL output.
Trait Implementations§
Source§impl Clone for ConversionOptions
impl Clone for ConversionOptions
Source§fn clone(&self) -> ConversionOptions
fn clone(&self) -> ConversionOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more