import { StarXpandCommand } from "star-io10-web"; export class LabelSample18_For203dpiAnd300dpi_BarcodeLabel2_Narrow_Template { static async createTemplate(): Promise { let builder = new StarXpandCommand.StarXpandCommandBuilder(); builder.addDocument( new StarXpandCommand.DocumentBuilder() // Change the printable area setting for this layout according to the printer resolution. // 48.0 for 203dpi, 34.0 for 300dpi .settingPrintableArea(48.0) //.settingPrintableArea(34.0) .addPrinter( new StarXpandCommand.PrinterBuilder() .styleAlignment(StarXpandCommand.Printer.Alignment.Center) .styleBold(true) .actionPrintText("${product_name}\n") .styleBold(false) .styleFont(StarXpandCommand.Printer.FontType.B) .actionPrintText( "${parameter1} / ${parameter2} / ${parameter3} / ${parameter4}\n", ) .actionPrintBarcode( new StarXpandCommand.Printer.BarcodeParameter( "${sku}", StarXpandCommand.Printer.BarcodeSymbology.UpcA, ) .setBarDots(3) .setHeight(12.0) .setPrintHri(true), ) .actionCut(StarXpandCommand.Printer.CutType.Partial), ), ); return await builder.getCommands(); } static async getFieldData(): Promise { return Promise.resolve( `{ "product_name" : "Product Name", "parameter1" : "SKU", "parameter2" : "Price", "parameter3" : "Variant option 1", "parameter4" : "Incl. VAT", "sku" : "012345789012" }`, ); } }