Template literal string parts
Interpolated values
Label instance for continued chaining
The label tagged template allows you to embed ZPL code directly in your TypeScript/JavaScript
and get back a fluent Label instance that you can continue to chain methods on.
Template literals can include interpolated values using ${} syntax, which will be inserted into the ZPL string before parsing.
Whitespace (including indentation) is preserved exactly as written. Align your template strings to column 0 if you do not want leading spaces emitted with your ZPL.
import { label } from '@schie/fluent-zpl'
const trackingNumber = '1234567890'
const myLabel = label`
^XA
^FO50,50^A0N,28,28^FDShipping Label^FS
^FO50,100^BCN,80,Y,N,N^FD${trackingNumber}^FS
^XZ
`
// Continue chaining fluent methods
myLabel.text({ at: { x: 50, y: 200 }, text: 'Additional text' })
.toZPL()
Tagged template literal for parsing ZPL strings into Label instances.
Label instance for continued chaining
The label tagged template allows you to embed ZPL code directly in your TypeScript/JavaScript
and get back a fluent Label instance that you can continue to chain methods on.
Template literals can include interpolated values using ${} syntax, which will be inserted into the ZPL string before parsing.
Whitespace (including indentation) is preserved exactly as written. Align your template strings to column 0 if you do not want leading spaces emitted with your ZPL.
import { label } from '@schie/fluent-zpl'
const trackingNumber = '1234567890'
const myLabel = label`
^XA
^FO50,50^A0N,28,28^FDShipping Label^FS
^FO50,100^BCN,80,Y,N,N^FD${trackingNumber}^FS
^XZ
`
// Continue chaining fluent methods
myLabel.text({ at: { x: 50, y: 200 }, text: 'Additional text' })
.toZPL()
Tagged template literal for parsing ZPL strings into Label instances.