Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,4 @@ android/keystores/debug.keystore
# Turborepo
.turbo/

# generated by bob
lib/
# generated by bob (removed: lib/ committed so pnpm git-dep install works without yarn/bob)
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,8 @@ class SunmiPrinterLibraryModule(reactContext: ReactApplicationContext) :
val decodedBitmap = BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.size)
val w = decodedBitmap.width
val h = decodedBitmap.height
val image = Bitmap.createScaledBitmap(decodedBitmap, pixelWidth, pixelWidth / w * h, false)
val scaledHeight = (pixelWidth.toLong() * h / w).toInt()
val image = Bitmap.createScaledBitmap(decodedBitmap, pixelWidth, scaledHeight, false)
printerService?.printBitmap(image, callback)
} catch (e: Exception) {
promise.reject("0", "native#printBitmapBase64 is failed. " + e.message)
Expand All @@ -577,7 +578,8 @@ class SunmiPrinterLibraryModule(reactContext: ReactApplicationContext) :
val decodedBitmap = BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.size)
val w = decodedBitmap.width
val h = decodedBitmap.height
val image = Bitmap.createScaledBitmap(decodedBitmap, pixelWidth, pixelWidth / w * h, false)
val scaledHeight = (pixelWidth.toLong() * h / w).toInt()
val image = Bitmap.createScaledBitmap(decodedBitmap, pixelWidth, scaledHeight, false)
printerService?.printBitmapCustom(image, type, callback)
} catch (e: Exception) {
promise.reject("0", "native#printBitmapBase64Custom is failed. " + e.message)
Expand Down
Loading