star-micronics / react-native-star-io10

react-native-star-io10 is a library for supporting application development for Star Micronics devices.
Other
88 stars 54 forks source link

Column support #11

Closed mic7010 closed 2 years ago

mic7010 commented 3 years ago

Does the SDK support columns whereby I can print a barcode followed by a price for example. If so, example code would be appreciated

bandit-ibayashi commented 3 years ago

You can create a column if it uses horizontal tabs. Define the tab position in advance with the styleHorizontalTabPositions method, and put the horizontal tab in the text.

var builder = new StarXpandCommand.StarXpandCommandBuilder();
builder.addDocument(new StarXpandCommand.DocumentBuilder()
    .addPrinter(new StarXpandCommand.PrinterBuilder()
        .styleAlignment(StarXpandCommand.Printer.Alignment.Center)
        .actionPrintBarcode(new StarXpandCommand.Printer.BarcodeParameter('0123456', StarXpandCommand.Printer.BarcodeSymbology.Jan8)
            .setBarDots(3)
            .setBarRatioLevel(StarXpandCommand.Printer.BarcodeBarRatioLevel.Level0)
            .setHeight(5)
            .setPrintHri(true)
        )
        .actionFeedLine(1)
        .styleAlignment(StarXpandCommand.Printer.Alignment.Left)
        .styleHorizontalTabPositions([12,37])
        .actionPrintText("SKU\tDescription\tTotal\n")
        .actionPrintText("------------------------------------------------")
        .actionPrintText("300678566\tPLAIN T-SHIRT\t10.99\n" + 
            "300692003\tBLACK DENIM\t29.99\n" + 
            "300651148\tBLUE DENIM\t29.99\n")
        .actionCut(StarXpandCommand.Printer.CutType.Partial)
    )
);
mic7010 commented 3 years ago

@bandit-ibayashi What I meant was showing a barcode next to it a price. Can the SDK support the format below?

image

mic7010 commented 3 years ago

@bandit-ibayashi - I am evaluating the Star printer and need to know if it will support the format above. Please answer either way.

mic7010 commented 3 years ago

@bandit-ibayashi - any comments?

gare-bear commented 3 years ago

@mic7010 the text portion ( Nestile Drink mix.../ Tuna Yellowfin) is no problem. But the printer cannot print a barcode and text side by side.

When printing barcodes, the next command/method always starts on the next line. For that reason, its not possible to print two different types of content side by side using actionPrintBarcode() and actionPrintText()

Instead create the content graphically and use actionPrintImage() to print it.