wmpf.printer(Object object)
Delivering Text Content to Device Printer Service - Asynchronous return
The following parameters are just examples, but the following values will be transmitted as JSON at actual runtime WMPF Client for use by developers. The JSON content and fields do not require formatting, and the parameter content contained in the example only provides reference and suggestions for specific business scenarios.
parameter
Object object
attribute | type | Introductions |
type | string | Print Type: base_string, ext_string, both_side, barcode, qrcode, image |
content | string | Printed content: both_side Type is json string {"left","text on the left","right":"text on the right"} 。image Type for the picture base64 coding |
style | Object | Font style |
barCodeOption | Object | qrcode to set |
imageOption | Object | If the width exceeds the width of the printing paper, the printing will not be complete. |
style
attribute | type | Introductions |
fontSize | int | Text size |
align | string | Text position, optional value: left / center / right. The default value is center |
bold | int | Whether in bold, int Type: 0 No, 1 yes The default value is 0 |
italic | int | Italic, int Type: 0 No, 1 yes The default value is 0 |
Underline | int | Whether to underline, int Type: 0 No, 1 yes The default value is 0 。ext_string, both_side Type Applicable |
leftOffset | int | Left offset, int Type: The default value is 0 。ext_string Type Applicable |
letterWidth | float | Letter width, float Type: The default value is 0 。ext_string Type Applicable |
lineSpacing | float | Row spacing, float Type: The default value is 1 。ext_string, both_side Type Applicable |
font | string | Font, optional value: default / default_bold / minivan / serif / sans_serif The default value is default 。ext_string, both_side Type Applicable |
barCodeOption
parameter | type | Introductions |
width | int | Width, int Type. The default value is 400 |
imageOption
attribute | type | Introductions |
width | int | Width, int type |
height | int | 初始值 type |
align | string | Image position, optional: left / center / right The default value is center |
offset | int | Offset value, int Type. The default value is 0 |
Return value
attribute | type | Introductions |
errMsg | string | Success: Ok, error: fail |
errCode | number | errMsg for fail Pass through the return value of the printer service |
sample code