EHpSRMlauv xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/TR/REC-html40">

打印原理及示例代码

1 AndroidPrinterSDK 提供的打印功能包括 打印文本,打印图片,打印表格,打印条码。

以上功能均需由连接成功的打印机实例调用。 如 mPrinter.printText();mPrinter.printImage(); mPrinter.printTable();mPrinter.printBarCode(); 以此为基础可拓展的功能包括,打印文件,打印画布,打印小票等。详见 AndroidPrinterDemo com.android.print.demo.utils 包下 PrintUtils.java

2 打印流程有两种。

<1>连接 - 打印 - 打印 - - 关闭 . 优点是打印间隔时间短,打印速度快,但如果有需求,实现蓝牙断线监测,蓝牙自动回连等功能需手动实现。

<2>连接 - 打印 - 关闭 连接 - 打印 - 关闭 . 优点是可避免蓝牙断线监测,自动回连等功能的实现,但打印间隔时间长,打印速度较慢。

 

 

Printing Theory and Sample Code

1.  All the above functions need to be called on the successfully connected printer.

e.g. mPrinter.printText();mPrinter.printImage();

mPrinter.printTable();mPrinter.printBarCode();

Basing on this code, extended functions can be: printing document, printing image, printing receipt, etc.

The detail refers: the “PrintUtils.java” of package “com.android.print.demo.utils” in of “AndroidPrinterDemo”.

2. There are two methods to control printing print work.

(1). Connect-print-print-…...-close. In this mode, the advantage is shorter interval and faster printing speed of print but disadvantage is the functions of “Bluetooth Disconnection Monitor Connecting Watch” and “Automatic Reconnection” have to be set by manual.

 

(2). Connect ?C print - close, connect ?C print ?C close.  In this mode, the advantage is needn’t control the functions of “Bluetooth Disconnection Monitor connecting watch” and “Automatic Reconnection ” are not needed but disadvantage is longer interval and slower printing speed.