The aim of this document is to assist you in triggering receipt printing from your custom application running on the Nomba Android terminal. If you encounter any difficulties with this process, feel free to reach out for support.

Trigger receipt printing - available since NombaX Application v1.6.2

Please note the the Nomba Pro terminals do not come with a built-in printer, but they can be connected to any Bluetooth printer. To establish a Bluetooth connection, you need to grant the permissions ACCESS_FINE_LOCATION_PERMISSION and ACCESS_COARSE_LOCATION_PERMISSION. Please make sure to grant these permissions before testing on the Nomba Pro.

Currently, the NombaX application parses an Arraylist of HashMaps to print receipts. The HashMap is to be structured as follows

Currently, the NombaX application parses an Arraylist of HashMaps to print receipts. The HashMap is to be structured as follows

import android.content.Context
import android.graphics.Bitmap
import android.os.Bundle
import android.util.Log
import androidx.annotation.DrawableRes
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.toBitmap

// Constants
const val ARGS_PRINT_DATA = "args_print_data"
const val ARGS_PRINT_BITMAP_DATA = "args_print_bitmap_data"

fun main() {
    // For Image/Icon (i.e, Logo)
    val logoMap: HashMap<String, Any> = hashMapOf()
    logoMap["content"] = "imageBitmap"
    logoMap["contentType"] = "IMAGE"
    logoMap["alignment"] = "CENTER | LEFT | RIGHT"

    val textMap: HashMap<String, Any> = hashMapOf()
    // For Text
    textMap["content"] = "text"
    textMap["contentType"] = "TEXT"
    textMap["alignment"] = "CENTER | LEFT | RIGHT"
    textMap["fontSize"] = "NORMAL | LARGE | SMALL | BIG | BIG2 | BIG3 | BIG4 | BIG5 | BIG6 | TALL | WIDE"
    textMap["isBold"] = true // or false

    // Create an ArrayList of the above maps
    val dataList = ArrayList<HashMap<*, *>>()

    // Add the maps to the ArrayList
    dataList.add(logoMap)
    dataList.add(textMap)

    // Create a bundle to be packaged with the intent
    val bundle = Bundle()

    // Pass the ArrayList to the intent
    bundle.putSerializable(ARGS_PRINT_DATA, dataList)

    // Convert drawable of your logo to bitmap
    val bitmap = convertDrawableResToBitmap(context, R.drawable.nombalogo)

    // Pass the bitmap to the intent
    bundle.putParcelable(ARGS_PRINT_BITMAP_DATA, bitmap)
}

// Convert drawable resource to bitmap
fun convertDrawableResToBitmap(context: Context, @DrawableRes drawableRes: Int): Bitmap? {
    return ContextCompat.getDrawable(context, drawableRes)?.toBitmap()
}