你的位置:首页 > 技术支持 > 软件下载

安卓网页打印,安卓网页打印,h5页面打印,浏览器打印,js打印工具

2017-6-11 11:03:15      点击:

适用范围:我司所有安卓系统而且带打印的设备

使用步骤:

1、机器安装最新SDK,已安装请忽略,(下载地址:www.nanfang001.com--下载中心--对应产品型号,一般产品出厂前已经安装过SDK)

2、下载安装本页下载连接中的打印浏览器并安装

3、对照下方事例代码,修改web页面打印功能

4、打印浏览器中打开web页面,测试打印功能

5、默认主页可以在SD卡根目录修改homepage.txt中的网址


 



软件支持android网页打印工具,安卓网页打印工具,h5页面打印,浏览器打印,js打印工具


web页面按照如下事例,修改打印函数代码,调用打印API即可完成打印功能



<html>
<head>
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
    <script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style type="text/css">
        div {
            margin: 5px 0;
        }

        input {
            width: 49%;
            height: 45 px;
            margin-right: 1%;
            margin-bottom: 1%;
        }

        #tipinfo {
            font-size: 15px;
            color: rgb(255,0,0);
            font-style: italic;
            height: auto;
        }
    </style>
    <script type="text/javascript">

        function javacalljs() {
            document.getElementById("tipinfo").innerHTML =
                "<br\>JAVA调用了JS的无参函数";
        }

        function javacalljswith(arg) {
            document.getElementById("tipinfo").innerHTML = (arg);
        }
    </script>
</head>
<body>
    <header class="bar bar-nav">
        <h1 class='title'>网页打印演示</h1>
    </header>
    <div class="content">
        <div class="content-padded grid-demo">

            <div id="tipinfo">打印机状态</div>
            <div class="item-content">
                <div class="item-media"><i class="icon icon-form-comment"></i></div>
                <div class="item-inner">
                    <div class="item-title label">输入打印内容</div>
                    <div class="item-input">
                        <textarea id="inputtxt">打印内容测试,一维码生成请输入数字</textarea>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-50">
                    <input type="button" class="button button-fill" value="生成二维码" onclick="window.android.createQRCode(document.getElementById('inputtxt').value)" />
                </div>
                <div class="col-50">
                    <input type="button" class="button button-fill" value="生成条码" onclick="window.android.createBarCode(document.getElementById('inputtxt').value)" />
                </div>
            </div>
            <div class="row">
                <div class="col-50">
                    <input type="button" class="button button-fill" value="打印文本" onclick="window.android.printText(document.getElementById('inputtxt').value)" />
                </div>
                <div class="col-50">
                    <input type="button" class="button button-fill" value="打印Unicode" onclick="window.android.printUnicode('hello, begin to smart print!')" />
                </div>
            </div>
            <div class="row">
                <div class="col-50">
                    <input type="button" class="button button-fill" value="选择图片" onclick="window.android.selectPic()" />
                </div>
                <div class="col-50">
                    <input type="button" class="button button-fill" value="打印图片" onclick="window.android.printPic()" />
                </div>
            </div>
            <div class="row">
                <div class="col-50">
                    <input type="button" class="button button-fill" value="打印网络图片" onclick="window.android.printNetPic()" />
                </div>
                <div class="col-50">
                    <input type="button" class="button button-fill" value="打印模板二" onclick="window.android.printStyleTwo()" />
                </div>
            </div>
            <div class="row">
                <div class="col-50">
                    <input type="button" class="button button-fill" value="打印模板一" onclick="window.android.printStyleOne()" />
                </div>
                <div class="col-50">
                    <input type="button" class="button button-fill" value="打印模板三" onclick="window.android.printStyleThree()" />
                </div>
            </div>
            <div class="row">
                <div class="col-50">
                    <input type="button" class="button button-fill" value="获取打印机状态" onclick="window.android.getPrintStatus()" />
                </div>
            </div>
        </div>
    </div>
</body>
</html>