DrawReceipt

Android lib to draw receipt as bitmap for thermal prints

License

License

GroupId

GroupId

com.github.danielfelgar
ArtifactId

ArtifactId

draw-receipt
Last Version

Last Version

0.1.3
Release Date

Release Date

Type

Type

aar
Description

Description

DrawReceipt
Android lib to draw receipt as bitmap for thermal prints
Project URL

Project URL

https://github.com/danielfelgar/DrawReceipt
Source Code Management

Source Code Management

https://github.com/danielfelgar/DrawReceipt

Download draw-receipt

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.danielfelgar/draw-receipt/ -->
<dependency>
    <groupId>com.github.danielfelgar</groupId>
    <artifactId>draw-receipt</artifactId>
    <version>0.1.3</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.danielfelgar/draw-receipt/
implementation 'com.github.danielfelgar:draw-receipt:0.1.3'
// https://jarcasting.com/artifacts/com.github.danielfelgar/draw-receipt/
implementation ("com.github.danielfelgar:draw-receipt:0.1.3")
'com.github.danielfelgar:draw-receipt:aar:0.1.3'
<dependency org="com.github.danielfelgar" name="draw-receipt" rev="0.1.3">
  <artifact name="draw-receipt" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.github.danielfelgar', module='draw-receipt', version='0.1.3')
)
libraryDependencies += "com.github.danielfelgar" % "draw-receipt" % "0.1.3"
[com.github.danielfelgar/draw-receipt "0.1.3"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

DrawReceipt

Android lib to draw receipt as bitmap for thermal prints

Screenshot

Version

0.1.3

Download

To use this library in your android project, just simply add the following dependency into your build.gradle

dependencies {
    compile 'com.github.danielfelgar:draw-receipt:0.1.3'
}

Usage

    ReceiptBuilder receipt = new ReceiptBuilder(1200);
    receipt.setMargin(30, 20).
            setAlign(Paint.Align.CENTER).
            setColor(Color.BLACK).
            setTextSize(60).
            setTypeface(this, "fonts/RobotoMono-Regular.ttf").
            addText("LakeFront Cafe").
            addText("1234 Main St.").
            addText("Palo Alto, CA 94568").
            addText("999-999-9999").
            addBlankSpace(30).
            setAlign(Paint.Align.LEFT).
            addText("Terminal ID: 123456", false).
            setAlign(Paint.Align.RIGHT).
            addText("1234").
            setAlign(Paint.Align.LEFT).
            addLine().
            addText("08/15/16", false).
            setAlign(Paint.Align.RIGHT).
            addText("SERVER #4").
            setAlign(Paint.Align.LEFT).
            addParagraph().
            addText("CHASE VISA - INSERT").
            addText("AID: A000000000011111").
            addText("ACCT #: *********1111").
            addParagraph().
            setTypeface(this, "fonts/RobotoMono-Bold.ttf").
            addText("CREDIT SALE").
            addText("UID: 12345678", false).
            setAlign(Paint.Align.RIGHT).
            addText("REF #: 1234").
            setTypeface(this, "fonts/RobotoMono-Regular.ttf").
            setAlign(Paint.Align.LEFT).
            addText("BATCH #: 091", false).
            setAlign(Paint.Align.RIGHT).
            addText("AUTH #: 0701C").
            setAlign(Paint.Align.LEFT).
            addParagraph().
            setTypeface(this, "fonts/RobotoMono-Bold.ttf").
            addText("AMOUNT", false).
            setAlign(Paint.Align.RIGHT).
            addText("$ 15.00").
            setAlign(Paint.Align.LEFT).
            addParagraph().
            addText("TIP", false).
            setAlign(Paint.Align.RIGHT).
            addText("$        ").
            addLine(180).
            setAlign(Paint.Align.LEFT).
            addParagraph().
            addText("TOTAL", false).
            setAlign(Paint.Align.RIGHT).
            addText("$        ").
            addLine(180).
            addParagraph().
            setAlign(Paint.Align.CENTER).
            setTypeface(this, "fonts/RobotoMono-Regular.ttf").
            addText("APPROVED").
            addParagraph().
            addImage(barcode);
    ivReceipt.setImageBitmap(receipt.build());

Change Logs

v0.1.3

[UPDATE] Update gradle [UPDATE] Update Build tools

v0.1.1

[UPDATE] Update gradle [UPDATE] Update Build tools [BUG] Color Black as default, Align LEFT as default

v0.1.0

Initial version

License

Apache 2.0

Versions

Version
0.1.3
0.1.2
0.1.1
0.1.0