Latest 0.1.5
Homepage https://github.com/chinhnguyen/RasterizedReceiptPrinting
License MIT
Platforms ios 9.0
Frameworks UIKit
Authors

CI Status
Version
License
Platform

Printing Unicode with Command mode to Receipt printers are not reliable. The best solution so far is to printing to a UIImage and then send the whole image over to printer.
With this approach, developer can control totally the Unicode printing work and it”s easier to manage the layout.
However, Mono-Font must be used to make alignment more precise.

RasterizedReceiptPrinting

Usage

Firstly, we must create a NSAttributedString.

  • Implement Swift:

    let printTemplate = NSMutableAttributedString(string: "")

Then, we can append new attributed string for this template like this.

  • Implement Swift:

    printTemplate.append("Hello World!!!n")
    printTemplate.appendCenter("This is a center body.n")
    printTemplate.appendBold("End World!!!n")

Finally, create image from custom string with page width setting.

  • Implement Swift:

    let image = printTemplate.rasterize(width: 576)

Congratulations! You’re done. 🎉

Installation

RasterizedReceiptPrinting is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'RasterizedReceiptPrinting'

Before using module

Swift

Add the following line in your Swift file:

import RasterizedReceiptPrinting

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • Swift 4.0
  • iOS 9.0 or later

Author

License

RasterizedReceiptPrinting is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "RasterizedReceiptPrinting",
    "version": "0.1.5",
    "summary": "Receipt printing to POS printer with support for Unicode",
    "platforms": {
        "ios": "9.0"
    },
    "description": "Printing Unicode with Command mode to Receipt printers are not reliable. The best solution so far is to printing to a UIImage and then send the whole image over to printer.nWith this approach, developer can control totally the Unicode printing work and it''s easier to manage the layout.nHowever, Mono-Font must be used to make alignment more precise.",
    "homepage": "https://github.com/chinhnguyen/RasterizedReceiptPrinting",
    "screenshots": "https://raw.githubusercontent.com/chinhnguyen/RasterizedReceiptPrinting/master/receipt_thermal.png",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "chinhnguyen": "[email protected]"
    },
    "source": {
        "git": "https://github.com/chinhnguyen/RasterizedReceiptPrinting.git",
        "tag": "0.1.5"
    },
    "social_media_url": "https://twitter.com/ngtr9h",
    "source_files": "RasterizedReceiptPrinting/Classes/**/*",
    "resource_bundles": {
        "RasterizedReceiptPrinting": [
            "RasterizedReceiptPrinting/Assets/*.ttf"
        ]
    },
    "frameworks": "UIKit",
    "swift_version": "4.0"
}

Pin It on Pinterest

Share This