Author SHA1 Message Date
lujiuyin 4c829f74a9 fix: accept RX1 encoded BMP dimensions 2026-08-22 09:17:27 +08:00
2 changed files with 37 additions and 22 deletions
+2 -2
View File
@@ -89,8 +89,8 @@ android {
applicationId = "com.yzx.kiosk"
minSdk = 26
targetSdk = 36
versionCode = 22
versionName = "1.1.2"
versionCode = 23
versionName = "1.1.3"
//multiDexEnabled = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
@@ -42,6 +42,11 @@ class PrinterService(
) {
companion object {
private const val TAG = "PrinterService"
// DNP BmpUtil 在 300 DPI 下会将 RX1 输入画布编码为 1844x1240 BMP。
// 1840x1240 仍是上层排版画布尺寸,不应用它校验 SDK 的最终文件头。
private const val RX1_ENCODED_BMP_WIDTH_300_DPI = 1844
private const val RX1_ENCODED_BMP_HEIGHT_300_DPI = 1240
}
private var mDnpPhotoPrint: DNPPhotoPrint? = null
@@ -274,10 +279,20 @@ class PrinterService(
throw IOException("BMP 保存接口返回失败")
}
val expectedBmpWidth: Int
val expectedBmpHeight: Int
if (printId != PrintManager.EPrinter.QW410_DEF.id) {
expectedBmpWidth = RX1_ENCODED_BMP_WIDTH_300_DPI
expectedBmpHeight = RX1_ENCODED_BMP_HEIGHT_300_DPI
} else {
expectedBmpWidth = printSize.width
expectedBmpHeight = printSize.height
}
val validation = PrintImageIntegrityValidator.validateBmp(
file = outFile,
expectedWidth = printSize.width,
expectedHeight = printSize.height
expectedWidth = expectedBmpWidth,
expectedHeight = expectedBmpHeight
)
LogUtils.d(
TAG,