using Neodynamic.Blazor;

[Inject]

public JSPrintManager JSPrintManager { get; set; }
    protected override void OnAfterRender(bool firstRender)
    {
        if (firstRender)
        {
            JSPrintManager.Start();
        }

        base.OnAfterRender(firstRender);
    }
   public async Task PrintSalesReceipt(string pOrderId)
    {

        var cpj = new ClientPrintJob();

        cpj.ClientPrinter = new DefaultPrinter();

        string cmds;

        // Start of Receipt
        cmds = RawPosCommand.INITIALIZE;

        // Receipt Header
        cmds += RawPosCommand.ALIGN_CENTER;
        cmds += RawPosCommand.FONT_H2;
        cmds += receipt.SalesReceiptHeaderText;
        cmds += RawPosCommand.NEWLINE;

        // Receipt Footer
        cmds += RawPosCommand.FONT_NORMAL;
        cmds += RawPosCommand.ALIGN_CENTER;
        cmds += receipt.SalesReceiptFooterText;
        cmds += RawPosCommand.NEWLINE2;
        cmds += RawPosCommand.NEWLINE2;
        cmds += RawPosCommand.NEWLINE2;

        cmds += RawPosCommand.CUT;

        cpj.PrinterCommands = cmds;

        JSPrintManager.SendClientPrintJob(cpj);

    }
Last modified: March 28, 2022

Author

Comments

Write a Reply or Comment