一门APP开发教程
标题: 一门APP使用JS调用中崎打印机说明 [打印本页]
作者: 曾清 时间: 2020-2-17 14:58
标题: 一门APP使用JS调用中崎打印机说明
一门APP使用JS调用中崎打印机说明
DEMO参考:https://www.yimenapp.com/doc/demo_zqprinter.cshtml
♦ js API 说明:
♦ 所有API接口具有统一的参数格式 function(options, callback);
♦ options 为 json 参数,没有参数传 null 即可;
♦ callback 为回调函数 function(text),统一返回字符串类型;
♦ byte[], Bitmap 类型的参数或返回值统一使用 BASE64 编码;
♦ 必要的时候请自行转换数据类型;
中崎小票打印机(ZQPrinterSDK)
SDK_Version
- jsBridge.zqprinter.SDK_Version(null
- , function(text) {
- alert(text);
- });
复制代码
Prn_GetPortList
- jsBridge.zqprinter.Prn_GetPortList({
- nPortType: 2
- }, function(text) {
- alert(text);
- });
复制代码
Prn_Connect
- jsBridge.zqprinter.Prn_Connect({
- strAddr: "USB0"
- }, function(text) {
- alert(text);
- });
复制代码
Prn_Disconnect
- jsBridge.zqprinter.Prn_Disconnect(null
- , function(text) {
- alert(text);
- });
复制代码
Prn_PrinterInit
- jsBridge.zqprinter.Prn_PrinterInit(null
- , function(text) {
- alert(text);
- });
复制代码
Prn_Status
- jsBridge.zqprinter.Prn_Status(null
- , function(text) {
- alert(text);
- });
复制代码
Prn_PowerStatus
- jsBridge.zqprinter.Prn_PowerStatus(null
- , function(text) {
- alert(text);
- });
复制代码
Prn_PrintText
- jsBridge.zqprinter.Prn_PrintText({
- Data: "Hello world\r\n",
- Alignment: 0,
- Attribute: 0,
- TextSize: 0
- }, function(text) {
- alert(text);
- });
复制代码
Prn_PrintEscText
- jsBridge.zqprinter.Prn_PrintEscText({
- strPrint: "ESC|bC" //加粗打印
- }, function(text) {
- alert(text);
- });
复制代码
Prn_PrintString
- jsBridge.zqprinter.Prn_PrintString({
- strPrint: "Hello world, 你好,世界。\r\n"
- }, function(text) {
- alert(text);
- });
复制代码
Prn_PrintBarcode
- jsBridge.zqprinter.Prn_PrintBarcode({
- strBarcode: "9771671216014",
- Symbology: 103, // EAN13
- Height: 20,
- Width: 3,
- TextPosition: 2
- }, function(text) {
- alert(text);
- });
复制代码
Prn_PrintQRCode
- jsBridge.zqprinter.Prn_PrintQRCode({
- nMode: 1,
- strCode: "https://m.baidu.com"
- }, function(text) {
- alert(text);
- });
复制代码
Prn_PrintBitmap
- jsBridge.zqprinter.Prn_PrintBitmap({
- //图片的 BASE64 编码
- image: "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAFWUlEQVR4Xu2aj21bNxDGjxPUmaDOBHUmSDJB2gnSTNDzBHUm0GWCJhPUmaDOBHUmqDNBnQlY/IJjQLCyeHwSBRkSgQcbenwk77vv/pFMcuQtHbn8cgLgxIAjR+BkAkdOgJMT3IsJqOp5Sul5zvlCRHjO/akJeCciPDcppduc8yczu5/N0GkAqOpZSul1zvlXF3qJLLcpJcs5f5wFxs4BQNsi8ruI/CwiZ43UX1zLtyLSape+hR0/Nt/R10Tk3a6B2CkAqorg2gj+WUTei8i1mUHxblNVgHghIrDnp+qD+5TS1Wq1etcdJNhhJwD4gv9oqP5BRK6iQj+0XmfUlYi8rvrAoF+2HZvxtgZAVdHSqtL6JzS3i8XVoDjImMFz/x2zeGNm10Flr+22FQAuPJqnfYX+ZgbdpzVVxcQAvDRAWDznYgDWCP/CzKDm9OZsuBGRH3yyxSAsAqARHieH8NNjdmMSRBvoX5zkSzMDlKE2DICj/5fbPLQ/37fwRUJ3kLAOJqCAZ6O+ZwkAf7u3R/i90X5DlCBkFnO4NbNnIxQYAkBVCUfEetpiuxtZYKRvY5KXZka0CLUwAE43tE/GRmpKpncwTVVhASESU3gaNcsRAAg1JCNQ/2LU1mYj5Qr6x+d5a2awtdtCAFDYiAiD85d8nFh8cE1Vi5LCLIgCUCcf0GtjTu+RAl+Bg3pvZm+XoOW1BTUBAqHVjXlGw4KQj4oCUDx/yPZVFbYQp0sLLaYGqXFsvLozs6c9IFWV3OBV1E91AWhQpQDZmHs3/ct6P5gZNUO4VXSuv4mwj3m+pedm1pWv26HRxJOId1VVTKSu6YdCE4tfk/N/MbOaVWvBdH/1r7/sKiwCADH1NxH5bGbYdLdVlVvxAYucpqoyNxrF9im0QrWGqtKPFLkbDSIAlPg6TOMuUpM6VObT9VkRAIpD66I5SZ7hYauMlY1VosiDLQJAjtrT8EonfVD5j25tMALAonJzkowbh1VVtE7F2o0EJwB6GlLVYgKPiQElc92JDygx/WidYAmDjwmAkrt0Q3fEB5RNkC6deua0r/fV3kA3A40AwMbHnxGPui8Be/OoKqkwpXvXb0UAYKCSW3cH7C1u9ntVLQr7ambt2eT/pu8C4IVJya27NuX9KVpWKaWbnDPfLNoy92P1Vzln4jp07p4tev1A7RJaaxSAUmLem9mTnhabzVO6XwMGRc1qteLo7MF2eXnJvt5FzhlN1mls1wk3O1fdSpBFRAGASqDP/nt3c8MXgieuDzRroctliPq3dZcmyvuPft64kUlV6R4qncMAOK1LNGDxHEB0ae1AwB40yS7NSIMpbL6MHKuXkN1VUllIiAEOQM2CLh3XSeo5etF0uRBB13JhAlD5nyKmC3A7hztADmvC+w9hAByEenMUFoQ2KEbUvu++QwA0ESFsCvsWamS+JQBA4XIgeWNmL0cmPLS+wwA4C75nh77v/+bQBIuuZxEADsL37Wf31njeYccVXeisfosBWAMCZgEIUx1jderEEd3whYgWyK0AqMyBM7lySYHT6UVHYZu07DlFuYZH11Cq22PO1gA4CO11lTu/z8dVua2a3zilHiARKwcjjMs5wdYmtxMAioS+G8tCy+UlQiXsQFvdQqZGyqlOKo2vKVUdN025grc19YczwaganaokTDwFCD7/dhGav14YtUOeVZepSZ3rUhbBAZa0eGut1xPvlAGNBhGAcMkzWgcwFBcxAAyfsjON79wJRpjhrECr5bo84PBwfoegJXKgXYQlwZoaTaaZQASQQ+ozzQQOSchNazkB8Fg0NWudJwbMQvaxjHtiwGPR1Kx1/gfMJFRfB1SS0QAAAABJRU5ErkJggg==",
- Type : 0
- }, function(text) {
- alert(text);
- });
复制代码
Prn_CutPaper
- jsBridge.zqprinter.Prn_CutPaper({
- nCutMode: 49
- }, function(text) {
- alert(text);
- });
复制代码
Prn_OpenCashbox
- jsBridge.zqprinter.Prn_OpenCashbox({
- iWitch: 0
- }, function(text) {
- alert(text);
- });
复制代码
Prn_LineFeed
- jsBridge.zqprinter.Prn_LineFeed({
- nLine: 3
- }, function(text) {
- alert(text);
- });
复制代码
Prn_MarkFeed
- jsBridge.zqprinter.Prn_MarkFeed(null
- , function(text) {
- alert(text);
- });
复制代码
Prn_SetCharacterSet
- jsBridge.zqprinter.Prn_SetCharacterSet({
- strCode: "gb2312"
- }, function(text) {
- alert(text);
- });
复制代码
Prn_SetInterCharacterSet
- jsBridge.zqprinter.Prn_SetInterCharacterSet({
- Value: 0
- }, function(text) {
- alert(text);
- });
复制代码
Prn_SetLineSpacing
- jsBridge.zqprinter.Prn_SetLineSpacing({
- nSpace: 8
- }, function(text) {
- alert(text);
- });
复制代码
Prn_SetFontStyle
- jsBridge.zqprinter.Prn_SetFontStyle({
- nStyle: 0
- }, function(text) {
- alert(text);
- });
复制代码
Prn_SetFontSize
- jsBridge.zqprinter.Prn_SetFontSize({
- nSize: 0
- }, function(text) {
- alert(text);
- });
复制代码
Prn_SetAlignment
- jsBridge.zqprinter.Prn_SetAlignment({
- nAlignment: 0
- }, function(text) {
- alert(text);
- });
复制代码
Prn_SendData
- jsBridge.zqprinter.Prn_SendData({
- byData: "" //base64 encoded data
- }, function(text) {
- alert(text);
- });
复制代码
Prn_ReadData
- jsBridge.zqprinter.Prn_ReadData({
- nTimeout: 5000
- }, function(text) {
- //返回 base64 encoded data
- alert(text);
- });
复制代码
Prn_BeginTransaction
- jsBridge.zqprinter.Prn_BeginTransaction(null
- , function(text) {
- alert(text);
- });
复制代码
Prn_EndTransaction
- jsBridge.zqprinter.Prn_EndTransaction(null
- , function(text) {
- alert(text);
- });
复制代码
Prn_GetMsrTrack
- jsBridge.zqprinter.Prn_GetMsrTrack({
- nTrack: 1,
- nTimeout: 5000
- }, function(text) {
- alert(text);
- });
复制代码
欢迎光临 一门APP开发教程 (https://bbs.yimenapp.com/) |
Powered by Discuz! X3.4 |