Printer
SDK Upgrade Description
Upgrade Notes
In order to make it easier for developers to call the built-in printer of iMin POS devices, and also to reduce the difficulty of developing printers and simplify app interfacing, we have reconstructed the iMin Print SDK.
Comparison of old and new features
SDK V2.0
Connection mode:Bluetooth(Bluetooth device name:BluetoothPrinter), AIDL etc.
Third-party apps can print by connecting to the built-in printer. Features included in iMin printer: 58 and 80mm thermal printer with two printing specifications, cutter (some machines)
Developers can refer to the built-in printer development documentation to understand how the printer works and how the interface is invoked
Built-in printer doc:iMin built-in printer developer document V2.0
1. Access the SDK
The iMin Print SDK is obtained from a remote repository, and you only need to add a dependency in the calling module’s build.gradle
1android {
2 ...
3}
4
5dependencies {
6 implementation 'com.github.iminsoftware:IminPrinterLibrary:V1.0.0.13'
7}
2. Refer to Demo
You can refer to SDK to use the source code of Demo for development, click the link below to jump to download the corresponding Demo above
3. Web print
- Demo Case
Desktop POS https://mp.imin.sg/WebPrint/D.html
Moblie POS https://mp.imin.sg/WebPrint/M.html
Note
SDK V2.0 does not require iMinprinterplugin to be installed,Enter the following URL address in the device browser to experience the H5 printing case
4. JavaScript API
Developers can use a JavaScript API to call the built-in printer
- Demo Case
JS Printer demo https://mp.imin.sg/JSPrinter/index.html
JS print development documentation
Note
SDK V2.0 does not require iMinprinterplugin to be installed.
5. Flutter
You can refer to the SDK to use the source code of Demo for development, click the link below to jump to download the corresponding Demo above
SDK V1.0
Connection method: Bluetooth (Bluetooth device name: BluetoothPrinter), USB. The third-party APP can print by connecting to the built-in printer. The functions included in the iMin printer: thermal printers with two printing specifications of 58 and 80mm, cutters (some machines), cash drawers (some machines)
The printing function interface of iMin is basically multiplexed, and the model applicable to the document will be slightly different according to the model: D series (D1, D1w, D4), M series (M2, etc.), S series (S1 etc.) Development
The printer is compatible with the ESC & POS command, but it is slightly different from the standard ESC & POS command. Developers can refer to the built-in printer development document to understand the printer’s working mode and interface calling method, and understand the escpos instruction set supported by iMin through the instruction document iMin built-in printer developer document V1.0
1. Refer to Demo
iMin provides printing demo and source code, and supports common printing functions, such as: printing QR code, printing barcode, printing pictures, printing texts in various languages, printing forms, etc. The demo supports both Bluetooth and USB connection methods. Developers need to adapt different SDK files to different iMin devices when developing printing functions.
PS:The demo only supports iMin built-in printers, external Bluetooth serial network USB printers are not suitable for this demo.
2. iMinprinterplugin
iMin provides a printing plug-in support through the native printing function of android. Users can search for iMinprinterplugin through the iMin App Store, and after downloading and installing it, they can print the webpage content through the browser’s printing function.
- Demo Case
Desktop POS https://mp.imin.sg/WebPrint/D.html
Moblie POS https://mp.imin.sg/WebPrint/M.html
Note
Enter the following URL address in the device browser to experience the H5 printing case
3. JavaScript API
Users can search for iMinprinterplugin through the iMin App Store, and after downloading and installing it,Developers can use a JavaScript API to call the built-in printer
- Demo Case
JS Printer demo https://mp.imin.sg/JSPrinter/index.html
JS print development documentation
Note
Users can search for iMinprinterplugin through the iMin App Store, and after downloading and installing it.
4. Flutter
You can refer to the SDK to use the source code of Demo for development, click the link below to jump to download the corresponding Demo above
SDK release notes
1. SDK V2.0
Version 1.0.0.13
May 17, 2024
first version
2. SDK V1.0
Version 1.3.1
09/10/2024
By default, grayscale processing is added to printed pictures to avoid the problem that color pictures cannot be printed.
Solve known bugs in transaction printing API
Adapt to self-developed printer firmware PC80, PC58
Solve the problem that the default initialization jar package automatically connects to USB to avoid the problem of quickly obtaining the printer status of -1 for the first time.
Support Code128 A B C type to print long data
Optimize the text printing image processing algorithm to solve the problem of garbled printing images in D4RK3288
Optimize the printing image algorithm to solve the problem of Barcode19 garbled characters printed by D1 devices
Logic adjustment of resetDevice(): 1. Set the printer status to -1 to logically delete the printer status. Setting the printer status to -1 will only be executed when the connection is disconnected or the transmission fails. 2. The printing thread is unlocked.
Solve the problem that part of the content of JS printed pictures is erased
The API related to transaction printing has been added to support model judgment. If the model does not support transaction printing, there will be no response when calling the API.
(Only supports self-developed PC58/pc80 printers) New QR code api printPDF417, printMaxiCode, printAztecCode, printDataMatrix
(Only supports self-developed PC58/pc80 printers) One-dimensional code adapts to GS1128, GS1DataBarOmnidirectional, GS1DataBarTruncated, GS1DataBarLimited, GS1DataBarExpanded
Added API to determine whether it is a self-developed printer firmware: mIminPrintUtils.isPC80();
Added a new method for printing color pictures printSingleColorChartBitmap(Bitmap bitmap,int isScale) // bitmap target picture, isScale == 1 for equal proportion enlargement, 0 for default size printing
Version 1.2.0
05/21/2024
Transaction print switchover failed to print problem resolved
D1 Transaction print adaptation (23-12-07B1 printer firmware started to adapt, the old firmware is not supported)
After switching device manager printing, print data duplication bug
Transaction printing sometimes returns values without callback issues resolved
USB to obtain printer status -1 USB read thread crash bug resolved
USB read return value timeout resolved
PC58 print double QR code adaptation (Currently only the latest ROM for M2 Max is supported)
Optimize the problem of high cpu usage in the stationary state of the printer
Switch device manager in switch back to print duplicate questions
ADAPTS to self-developed printer firmware (Currently only the latest ROM for M2 Max is supported)
Print picture setup alignment bug
Added transaction printing function
D4 Cannot get the printer status after clicking initialize, and cannot print the first time
D4 Click Transaction Print, send three strokes to print garbled characters
Bluetooth print repeatedly causes disconnection and reconnection after calling initPrinter repeatedly
Print picture Settings Center Left right problem Print Settings fail for several consecutive times
Call initPrinter during transaction printing, print interruption problem
Unable to continue printing after call disconnection Problem resolved
Third party library rxjava referenced by SDK, Observer subthread data switching main thread problem resolved
Print picture setup alignment bug
Adaptive Printer Firmware (PC58) (Currently only the latest ROM for M2 Max is supported)
version 1.1.0
05/21/2024
Compatible with PC58 and PC80 printers
Solve the bug of alignment in printing picture settings
Added transaction printing function
Solve the problem that D4 cannot obtain the printer status after clicking initialization and cannot print for the first time.
Solve the problem of D4 clicking transaction print and printing garbled characters after sending three transactions.
Solve the problem of Bluetooth printing causing disconnection and reconnection after repeatedly calling initPrinter.
Solve the problem of printing picture settings being centered, left, and right. The print settings fail multiple times in a row.
Solve the problem of calling initPrinter during transaction printing and printing interruption.
Solve the problem of being unable to continue printing after calling disconnection
Solving the problem of main thread switching of Observer sub-thread data in the third-party library rxjava referenced by the SDK
Solve the bug of setting alignment of printed pictures
Use an external printer
iMin printers mainly include two types: built-in printers and external independent printers. This document mainly introduces the quick use of external printers through SDK;
Before developing a printer program, you need to have a certain understanding of the working principle of a receipt printer and the ESC/POS instruction set in order to understand the basic knowledge required for receipt typesetting;
Current external printers include:
HPRT Printer
SEIKO Printer
Print Service F&Q
Print paper specifications
Note: The iMin printer supports 58mm and 80mm printing paper. This document uses 58mm printing paper as an example to explain the printer’s support parameters. The specifications of 80mm printing paper are similar
A piece of 58 printing paper has a width of 58mm and an effective printing width of 48mm. The effective printing width is 384 pixels.
The depth of M2 / D1 / D1 Pro paper chute is 40mm, and it can hold up to 40mm diameter paper.
The depth of D1w / D4 / S1 paper slot is 80mm, and it can hold up to 80mm paper.
What is the printer resolution?
The printer resolution is 205DPI, the calculation formula is as follows
DPI=384dots/48mm=8dots/1mm=205dots/in=205