Previous topicNext topic
 XXXX Help
Help > Modules > print module >

Function

                print data. To easy to tear sheet, several line will be left at the bottom. If it is not needed, printNoFeed can be called

     Parameter

ParaName

Type

Description

json

String

The json character string to be printed. the string formats can be seen in the Appendix

bitmap

Bitmap[]

The bitmap array to be printed, arranged as the order of the json character string

listener

AidlPrinterListener

print callback

new OnPrinterListener()

                

     Return value

    

return value

Description

null

 

Format and content can be controlled through the passed json string when the text or image is printed.

Example:

{

    "spos":[

        {

            "content-type":"txt",

            "size":"2",

            "content":"示例文字\n",

            "position":"left",

"italic":"1",

            "bold":"1",

        },

        {

            "content-type":"jpg",

            "position":"center",       

        },

        {

            "content-type":"two-dimension",

"size":"2",

"content":"891110847565611252"

},

{

    "content-type":"one-dimension",

    "size":"2",

    "height":"1",

    "content":"891110847565611252"

}

]

}

Notice:

1.The content to be printed should be put in the array of container named “spos”. An element of the array is the smallest printable unit. And an element represents a paragraph with the same format.

2. Both key and value are denoted with String.

3.Json string and bitmap array are passed into the print interface.

4.If image is printed, “content” is not passed in and the length of “spos” array must be one .

Key

Value

content-type

Content type, optional fields:

”txt”,“jpg”,

”one-dimension”(one-dimensional code),

 “two-dimension”(two-dimensional code)

(Required)

Size

Printing type is txt:

The optional fields of the txt sizes: 1-3

Printing type is two-dimension:

The sizes of two-dimensional code: 1-8.

Printing type is one-dimension:

The width of one-dimensional code: 1-3

Content

The printed txt/one-dimensional /two-dimensional code

Position

Alignment, optional fields “left”, “center”, “right”  Default: left

(Optional)

Offset

Offset, no effect currently

italic

“1”: Italic, “0” normal   Default: 0

(Optional)

Bold

“1”: Bold, “0”: No bold  Default: 0

(Optional)

Height

The height of one-dimensional code: 1-3