API
Converting
convert() from @zplkit/core/convert, and its options.
import { convert } from "@zplkit/core/convert";Converting ZPL to code explains what the converted code looks like.
convert
convert(zpl: string, options?: ConvertOptions): stringTurns ZPL into zplkit code that builds the same labels, as JSX or Label method calls. Takes ConvertOptions:
| Property | Type | Default | Description |
|---|---|---|---|
style? | "builder" | "jsx" | "jsx" | The code to write: JSX elements or Label method calls |
dpmm? | 6 | 8 | 12 | 24 | 8 | Dots per millimeter of the printer the ZPL is for |
units? | "dots" | "mm" | "mm" | Lengths in millimeters where they convert back to exactly the same dots, or always in dots |
labelSize? | object | 101.6 by 152.4 (4 by 6 inches) | The size of labels that don't set ^PW and ^LL, in millimeters |