KevinGong2013 / Printer

Swift ticket printer framework for ESC/POS-compatible thermal printers.
Apache License 2.0
144 stars 72 forks source link

TVS thermal printer terminating while printing receipt #62

Open harish8118 opened 1 year ago

harish8118 commented 1 year ago

TVS thermal printer terminating while printing receipt in Swift code. It was able to print only header details, then printing terminating and get shut down. Help me out from this issue.

KevinGong2013 commented 1 year ago

Printer framework has been rewrite.

Paster your receipt in this issue.

eg:

        let receipt = Receipt(.init(maxWidthDensity: 500, fontDesity: 12, encoding: .utf8))
        <<~ .style(.initialize)
        <<~ .page(.printAndFeed(lines: 3))
        <<~ .layout(.justification(.center))
        <<< Dividing.`default`()
        <<~ .style(.underlineMode(.enable2dot))
        <<< "Testing"
        <<< KV("k", "v")
        <<~ .style(.clear)
        <<< Image(cgImage, grayThreshold: 28)
        <<< Dividing.`default`()
        <<~ .page(.printAndFeed(lines: 0))
        <<~ .style(.initialize)
        <<< QRCode(content: "https://www.yuxiaor.com")
        <<~ .cursor(.lineFeed)
        <<< Command.cursor(.lineFeed)
        <<~ .cursor(.lineFeed)