• HTML针式打印机打印模板


    直接复制在html文件中,然后把打印的内容放在.orderprint中,然后根据需要调整大小即可.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="__PUBLIC__/static/css/base.css" rel="stylesheet" type="text/css" />
        <link href="__PUBLIC__/static/css/seller_center.css" rel="stylesheet" type="text/css" />
        <link href="__PUBLIC__/static/font/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
        <!--[if IE 7]>
        <link rel="stylesheet" href="__PUBLIC__/static/font/font-awesome/css/font-awesome-ie7.min.css">
        <![endif]-->
        <style type="text/css">
            body {
                background: #FFF none;
            }
    
            .ncsc-order-details {
                 50%;
                box-sizing: border-box;
            }
    
            .ncsc-order-details:last-child {
                border-right: 0
            }
    
            .ncsc-order-details .content dl dd a,
            .ncsc-order-contnet .daddress-info dd a {
                float: none;
                padding-left: 0
            }
    
            .A4 {
                page-break-before: auto;
                page-break-after: always;
            }
    
            .print-layout {
                 241mm;
                height: 140mm;
                margin: 20px auto 0;
                padding: 0;
            }
    
            .print-layout .print-page {
                 100%;
                height: 100%;
                top: 0;
                left: 0;
                margin: 0;
                overflow: hidden;
            }
    
            .orderprint {
                 100%;
                height: 100%;
                padding: 0;
            }
    
            .orderprint .top {
                 auto;
            }
    
            .buyer-info {
                margin: 15px 15px;
            }
    
            .ncsc-order-details .content {
                padding: 5px 15px 0px 15px;
            }
    
            .ncsc-order-details .content dl,
            .ncsc-order-contnet .daddress-info {
                margin-bottom: 5px;
            }
        </style>
        <title>针式打印机打印模板</title>
    </head>
    
    <body>
    
        <div class="batch" style="text-align: center;margin-top: 15px;">
            <div class="print-btn" id="printbtn" title="选择喷墨或激光打印机<br/>根据下列纸张描述进行<br/>设置并打印发货单据">
                <i></i>
                <a href="javascript:void(0);" onclick="preview();" class="ncap-btn-big ncap-btn-green"><i class="fa fa-print"></i>打印</a>
            </div>
        </div>
        <!--startprint-->
        <volist name="orders" id="vo">
            <div class="print-layout" style="page-break-after:always;">
                <div class="print-page">
                    <div id="printarea">
                        <div class="orderprint">
                       
                        </div>
                    </div>
                </div>
            </div>
            <div></div>
        </volist>
        <!--endprint-->
        <script type="text/javascript">
            function preview() {
                bdhtml = window.document.body.innerHTML;//获取当前页的html代码
                sprnstr = "<!--startprint-->";//设置打印开始区域
                eprnstr = "<!--endprint-->";//设置打印结束区域
                prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) + 17); //从开始代码向后取html
                prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));//从结束代码向前取html
                window.document.body.innerHTML = prnhtml;
                window.print();
                window.document.body.innerHTML = bdhtml;
            }
        </script>
    </body>
    
    </html>
    
    所触及过的星空,哪怕牺牲所有,也竭力想要抵达的地方!
  • 相关阅读:
    Python 中的map函数,filter函数,reduce函数
    编程中,static的用法详解
    C++ list容器系列功能函数详解
    python中的configparser类
    310实验室OTL问题----将写好的C++文件转换成Python文件,并将数据可视化
    310实验室OTL问题
    常量指针、指针常量、指向常量的指针常量
    Iterator迭代器的相关问题
    struts2中action中的通配符
    struts2访问servlet API
  • 原文地址:https://www.cnblogs.com/lishaoxiong/p/14828439.html
Copyright © 2020-2023  润新知