Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7d299f7
[UNTIL-19417] Migrate ImageBitmap to Compose Multiplatform (v3.0.5)
shekar-allam Mar 17, 2026
8cebb40
[UNTIL-19417] Add iOS sample app with Compose Multiplatform support
shekar-allam Mar 18, 2026
6c63ac1
Update .gitignore with complete Xcode/iOS patterns
shekar-allam Mar 18, 2026
be8068e
[UNTIL-19417] Fix iOS sample blank screen on iPad + implement Epson i…
shekar-allam Mar 19, 2026
8444ac4
[UNTIL-19417] Fix SDK constants, error handling, resource leaks, and …
shekar-allam Mar 20, 2026
8f6f366
[UNTIL-19514] Add discovery status display and ExternalAccessory prot…
shekar-allam Mar 20, 2026
323cc34
[UNTIL-19417] Remove discovery code — moved to UNTIL-19514 branch
shekar-allam Mar 20, 2026
5c12e9b
[UNTIL-19514] Add Epson printer discovery for iOS
shekar-allam Mar 20, 2026
b99ae89
[UNTIL-19417] Clean up Epson build config and auto-download SDK
shekar-allam Mar 20, 2026
e9837d0
Merge branch 'shekar/task/UNTIL-19417/print-engine-kmp-3.0.5' into sh…
shekar-allam Mar 20, 2026
db1b743
[UNTIL-19417] Clean up Epson build config and auto-download SDK
shekar-allam Mar 20, 2026
5deccb0
Merge branch 'shekar/task/UNTIL-19417/print-engine-kmp-3.0.5' into sh…
shekar-allam Mar 20, 2026
5a6c4ba
Fix formatting violations in EpsonPrinterDiscovery.ios.kt
shekar-allam Mar 20, 2026
74667cd
[UNTIL-19417] Fix Epson iOS cinterop commonization and use SDK consta…
shekar-allam Mar 24, 2026
ff20dda
[UNTIL-19417] Update README with KMP, Maven Central, and iOS info
shekar-allam Mar 24, 2026
2994fbb
[UNTIL-19417] Add Compose UI setup, fix plugin coordinates in README
shekar-allam Mar 24, 2026
37697f7
[UNTIL-19417] Clean up README — remove legacy JitPack, use Maven Cent…
shekar-allam Mar 24, 2026
0c6a9ed
[UNTIL-19417] Remove ProGuard note from README
shekar-allam Mar 24, 2026
af739ee
Merge pull request #56 from tillhub/shekar/task/UNTIL-19514/print-eng…
djordjeh Mar 25, 2026
9fdb03d
Merge pull request #55 from tillhub/shekar/task/UNTIL-19417/print-eng…
djordjeh Mar 26, 2026
084c2ca
Merge branch 'master' into develop
djordjeh Apr 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,47 @@ lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

# Claude Code local settings
.claude/settings.local.json

# Xcode / iOS
## User-specific settings
xcuserdata/
*.xcuserstate
## Legacy per-user project settings (keep default.* variants)
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
## Source control metadata
*.xccheckout
*.xcscmblueprint
## Misc
*.moved-aside
*.hmap
DerivedData/

# iOS build artifacts
*.ipa
*.xcarchive
*.dSYM
*.dSYM.zip

# CocoaPods
# Pods/ and Podfile.lock are intentionally NOT ignored — treat them like package-lock.json
# Uncomment below only if your team explicitly does not commit Pods:
# Pods/

# Swift Package Manager
.build/
.swiftpm/
# Package.resolved is intentionally NOT ignored — it is a lockfile for reproducible builds

# Epson iOS SDK — binary artifact, not committed to git
# Download script: see print-plugins/epson/nativeInterop/README.md
print-plugins/epson/nativeInterop/libs/
135 changes: 100 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,86 @@
[![](https://jitpack.io/v/tillhub/print-engine.svg)](https://jitpack.io/#tillhub/print-engine)
[![API](https://img.shields.io/badge/API-21%2B-green.svg?style=flat)](https://android-arsenal.com/api?level-11)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.tillhub/print-engine-core.svg)](https://central.sonatype.com/artifact/io.github.tillhub/print-engine-core)
[![API](https://img.shields.io/badge/API-24%2B-green.svg?style=flat)](https://android-arsenal.com/api?level=24)

# Print Engine

This library combines various printer implementations into a single, easy-to-use interface.
Built as a Kotlin Multiplatform (KMP) library, it supports both Android and iOS platforms.

### Supported Platforms

| Platform | Built-in Printers | External Printers |
|----------|------------------|-------------------|
| Android | PAX, Sunmi, Verifone | Star, Epson |
| iOS | — | Star, Epson |

# How to setup

**Step 1.** Add the JitPack repository to your `settings.gradle` file:
**Step 1.** Add Maven Central to your repository list:

```groovy
```kotlin
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
...
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
```

**Step 2.** Add the dependency to your app `build.gradle`:
**Step 2.** Add the core dependency and the plugins you need:

```groovy
```kotlin
// build.gradle.kts
dependencies {
implementation 'com.github.tillhub:print-engine:x.x.x'
// Core library (required)
implementation("io.github.tillhub:print-engine-core:3.0.5")

// Built-in printer plugins (Android only)
implementation("io.github.tillhub:print-engine-pax:3.0.5")
implementation("io.github.tillhub:print-engine-sunmi:3.0.5")
implementation("io.github.tillhub:print-engine-verifone:3.0.5")

// External printer plugins (Android & iOS)
implementation("io.github.tillhub:print-engine-star:3.0.5")
implementation("io.github.tillhub:print-engine-epson:3.0.5")
}
```

**Step 3.** Enable JNI legacy packaging
**Step 3.** If you use `PrintCommand.Image`, add Compose UI since `ImageBitmap` is part of the API:

```groovy
packaging {
jniLibs {
useLegacyPackaging = true
```kotlin
// build.gradle.kts
plugins {
id("org.jetbrains.kotlin.plugin.compose")
id("org.jetbrains.compose")
}

dependencies {
implementation(compose.ui)
}
```

**Step 4.** Enable JNI legacy packaging (Android only):

```kotlin
// build.gradle.kts
android {
packaging {
jniLibs {
useLegacyPackaging = true
}
}
}
```

# Usage

This SDK offers supports 2 types printing devices:
This SDK offers supports the following printing devices:

* PAX devices with a build in printer (A920, A920 pro, etc.)
* Sunmi devices with a build in printer (V2, V2 PRO, V2s, etc.)
* Verifone devices with a build in printer
* Star Micronics external printers (via StarXpand SDK)
* Epson external printers (via ePOS2 SDK)

For devices without printer support the SDK defaults to an `EmulatedPrinter` implementation that
prints into Logcat, this way it is easy to develop on emulators and unsupported devices.
Expand Down Expand Up @@ -118,7 +155,7 @@ List of commands:

```kotlin
PrintCommand.Text(val text : String)
PrintCommand.Image(val image : Bitmap)
PrintCommand.Image(val image : ImageBitmap)
PrintCommand.Barcode(val barcode : String)
PrintCommand.QrCode(val code : String)
PrintCommand.RawData(val data : RawPrinterData)
Expand Down Expand Up @@ -192,14 +229,14 @@ override fun onCreate(savedInstanceState: Bundle?) {

val barcodeEncoder = printEngine.barcodeEncoder

val qrCode: Bitmap? = barcodeEncoder.encodeAsBitmap(
val qrCode: ImageBitmap? = barcodeEncoder.encodeAsBitmap(
content = "barcode_content",
type = BarcodeType.QR_CODE,
imgWidth = 500,
imgHeight = 500
)

val code128: Bitmap? = barcodeEncoder.encodeAsBitmap(
val code128: ImageBitmap? = barcodeEncoder.encodeAsBitmap(
content = "barcode_content",
type = BarcodeType.CODE_128,
imgWidth = 500,
Expand All @@ -213,14 +250,13 @@ override fun onCreate(savedInstanceState: Bundle?) {
### Star Printer Library

A library for integrating Star Micronics printers using the StarXpand SDK.
Supports Android and iOS.

#### Installation

Add to your `build.gradle`

```gradle
implementation 'com.tillhub.printengine:star-printer:1.0.0'
```
```kotlin
implementation("io.github.tillhub:print-engine-star:3.0.5")
```

#### Setup & Usage

Expand Down Expand Up @@ -270,7 +306,7 @@ Add to your `build.gradle`

if (permissions.isNotEmpty()) {
launcher.launch(permissions.toTypedArray())
}
}
```
To avoid the USB connection permission dialog appearing every time a cable is connected or
disconnected, add the following `<intent-filter>` and `<meta-data>` entries to your
Expand All @@ -282,7 +318,7 @@ Add to your `build.gradle`
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
```
2. **Discovery**
2. **Discovery**
To begin discovering Star printers, use the following method and handle the results accordingly:

```kotlin
Expand All @@ -291,7 +327,7 @@ Add to your `build.gradle`
// Handle discoveryState result
}
```
3. **Initialization & Printing**
3. **Initialization & Printing**
Once a user selects a Star printer, initialize and start printer using the following approach:

```kotlin
Expand All @@ -303,21 +339,23 @@ Add to your `build.gradle`
printerEngine.initPrinter(service)
printerEngine.printer.startPrintJob(printJob)
```

### Epson Printer Library

A library for integrating Epson printers using the ePOS2 lib.
Supports Android and iOS.

#### Installation
> **Note:** On iOS, the Epson ePOS2 SDK (~68 MB) is automatically downloaded on the first build.

Add to your `build.gradle`
#### Installation

```gradle
implementation 'com.tillhub.printengine:epson-printer:1.0.0'
```
```kotlin
implementation("io.github.tillhub:print-engine-epson:3.0.5")
```

#### Setup & Usage

1. **Permissions**
1. **Permissions (Android)**
These permissions enable Bluetooth communication and scanning to discover and connect to nearby devices,
add the following permissions check logic:
```kotlin
Expand Down Expand Up @@ -363,7 +401,7 @@ Add to your `build.gradle`

if (permissions.isNotEmpty()) {
launcher.launch(permissions.toTypedArray())
}
}
```
To avoid the USB connection permission dialog appearing every time a cable is connected or
disconnected, add the following `<intent-filter>` and `<meta-data>` entries to your
Expand All @@ -381,7 +419,20 @@ Add to your `build.gradle`
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/accessory_filter" />
```
2. **Discovery**

2. **Permissions (iOS)**
Add the following keys to your `Info.plist`:

```xml
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Required for Bluetooth printer communication</string>
<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>com.epson.escpos</string>
</array>
```

3. **Discovery**
To begin discovering Epson printers, use the following method and handle the results accordingly:

```kotlin
Expand All @@ -390,7 +441,7 @@ Add to your `build.gradle`
// Handle discoveryState result
}
```
3. **Initialization & Printing**
4. **Initialization & Printing**
Once a user selects a Epson printer, initialize and start printer using the following approach:

```kotlin
Expand All @@ -402,6 +453,20 @@ Add to your `build.gradle`
printerEngine.initPrinter(service)
printerEngine.printer.startPrintJob(printJob)
```

## Architecture

```
print-engine/ Core KMP module (commonMain, androidMain, iosMain)
print-plugins/
pax/ PAX built-in printer (Android only)
sunmi/ Sunmi built-in printer (Android only)
verifone/ Verifone built-in printer (Android only)
star/ Star Micronics external printer (Android & iOS)
epson/ Epson external printer (Android & iOS)
sample/ Demo app (Android & iOS)
```

## Credits

- [Đorđe Hrnjez](https://github.com/djordjeh)
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
kotlin.code.style=official
kotlin.daemon.jvmargs=-Xmx3072M
kotlin.mpp.androidSourceSetLayoutVersion=2
kotlin.mpp.enableCInteropCommonization=true

#Gradle
org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
print-engine = "3.0.3"
print-engine = "3.0.5"

# Build tools
kotlin = "2.2.0"
Expand Down
Loading
Loading