Skip to content

PeriPage Bluetooth Printer Library v1.0.0

Latest
Compare
Choose a tag to compare
@Dibyakshu Dibyakshu released this 26 Oct 17:01
· 19 commits to main since this release

Release Description - PeriPage Bluetooth Printer Library v1.0.0

We are excited to announce the release of PeriPage Printer Library v1.0! This release marks a significant milestone in simplifying the process of connecting to and printing content on PeriPage portable printers via Bluetooth.

What's New in v1.0

Key Features

  • Bluetooth Connection: Easily connect to a PeriPage printer via Bluetooth.
  • Text-to-Bitmap Conversion: Convert multiline text into a bitmap with a specified font and size for printing.
  • Image Printing: Print images on PeriPage printers by converting and sending bitmap data.
  • Feed Printing: Print a specified number of feed lines, with options for blank or filled lines.

Bluetooth Permissions Handling

PeriPage Printer Library simplifies Bluetooth permissions handling by automatically checking and requesting permissions as needed, ensuring a seamless user experience on various Android versions.

Printing Convenience

The library provides simple and convenient functions to print text, images, and feed lines. It also handles Bluetooth connection and disconnection, making it easier than ever to print content on PeriPage printers.

Getting Started

To start using the PeriPage Printer Library, follow these steps:

  1. Clone the repository or download the library files.
  2. Include the library in your Android Studio project by adding the necessary source files.

Usage Examples

Here are some usage examples to get you started with the PeriPage Printer Library:

// Initialize the BluetoothHelper
val bluetoothHelper = BluetoothHelper(appActivity, context)

// Check and request Bluetooth permissions if necessary
bluetoothHelper.checkAndRequestBluetoothPermission()

// Connect to the PeriPage printer
if (!bluetoothHelper.isPrinterConnected()) {
    if (bluetoothHelper.connectPrinter()) {
        // Connection successful
    } else {
        // Connection failed
    }
} else {
    // Printer is already connected
}

// Print text
val text = "Hello, PeriPage Printer!"
val fontSize = 20F
val fontId = R.font.courier_new
val bitmap = bluetoothHelper.messageToBitmap(text, fontId, fontSize)
bluetoothHelper.printImage(bitmap)

// Print feed lines
val linesToFeed = 3
val printBlankLines = true
bluetoothHelper.printFeed(linesToFeed, printBlankLines)

// Disconnect from the printer
bluetoothHelper.disconnectPrinter()

Contributions

Contributions to this library are welcome. If you have suggestions, feature requests, or find any issues, please open a GitHub issue or submit a pull request. Together, we can make the PeriPage Printer Library even better.

License

This PeriPage Printer Library is provided under the MIT License. You are free to use and modify the code according to the terms of the license.

Thank you for choosing the PeriPage Printer Library. We hope it simplifies your PeriPage printing experience. Enjoy printing with ease!