敬告:此 demo 演示为开放测试页面,仅用于开发者快速测试体验应用功能,请严格遵守开发者协议,云顶集团3118-云顶集团3118acm登录入口。
♦ js-sdk 引用方式:
♦ 普通网页 script 方式加载:下载最新版 ,请在页面上调用 jsbridge 接口之前引用 jsbridge-mini.js 库;
♦ js module 方式引用:npm install ym-jsbridge
♦
♦ js api 说明:
♦ 所有api接口具有统一的参数格式 function(options, callback);
♦ options 为 json 参数,没有参数传 null 即可;
♦ options 的 json 字段名称与类型和 的参数名与类型相同;
♦ callback 为回调函数 function(text),统一返回字符串类型;
♦ byte[], bitmap 类型的参数或返回值统一使用 base64 编码;
♦ 必要的时候请自行转换数据类型;
jsbridge.zqprinter.sdk_version(null , function(text) { alert(text); });
jsbridge.zqprinter.prn_getportlist({ nporttype: 2 }, function(text) { alert(text); });
jsbridge.zqprinter.prn_connect({ straddr: "usb0" }, function(text) { alert(text); });
jsbridge.zqprinter.prn_disconnect(null , function(text) { alert(text); });
jsbridge.zqprinter.prn_printerinit(null , function(text) { alert(text); });
jsbridge.zqprinter.prn_status(null , function(text) { alert(text); });
jsbridge.zqprinter.prn_powerstatus(null , function(text) { alert(text); });
jsbridge.zqprinter.prn_printtext({ data: "hello world\r\n", alignment: 0, attribute: 0, textsize: 0 }, function(text) { alert(text); });
jsbridge.zqprinter.prn_printesctext({ strprint: "esc|bc" //加粗打印 }, function(text) { alert(text); });
jsbridge.zqprinter.prn_printstring({ strprint: "hello world, 你好,世界。\r\n" }, function(text) { alert(text); });
jsbridge.zqprinter.prn_printbarcode({ strbarcode: "9771671216014", symbology: 103, // ean13 height: 20, width: 3, textposition: 2 }, function(text) { alert(text); });
jsbridge.zqprinter.prn_printqrcode({ nmode: 1, strcode: "https://m.baidu.com" }, function(text) { alert(text); });
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); });
jsbridge.zqprinter.prn_cutpaper({ ncutmode: 49 }, function(text) { alert(text); });
jsbridge.zqprinter.prn_opencashbox({ iwitch: 0 }, function(text) { alert(text); });
jsbridge.zqprinter.prn_linefeed({ nline: 3 }, function(text) { alert(text); });
jsbridge.zqprinter.prn_markfeed(null , function(text) { alert(text); });
jsbridge.zqprinter.prn_setcharacterset({ strcode: "gb2312" }, function(text) { alert(text); });
jsbridge.zqprinter.prn_setintercharacterset({ value: 0 }, function(text) { alert(text); });
jsbridge.zqprinter.prn_setlinespacing({ nspace: 8 }, function(text) { alert(text); });
jsbridge.zqprinter.prn_setfontstyle({ nstyle: 0 }, function(text) { alert(text); });
jsbridge.zqprinter.prn_setfontsize({ nsize: 0 }, function(text) { alert(text); });
jsbridge.zqprinter.prn_setalignment({ nalignment: 0 }, function(text) { alert(text); });
jsbridge.zqprinter.prn_senddata({ bydata: "" //base64 encoded data }, function(text) { alert(text); });
jsbridge.zqprinter.prn_readdata({ ntimeout: 5000 }, function(text) { //返回 base64 encoded data alert(text); });
jsbridge.zqprinter.prn_begintransaction(null , function(text) { alert(text); });
jsbridge.zqprinter.prn_endtransaction(null , function(text) { alert(text); });
jsbridge.zqprinter.prn_getmsrtrack({ ntrack: 1, ntimeout: 5000 }, function(text) { alert(text); });