精华内容
下载资源
问答
  • jQuery 网页打印组件升级版(支持打印 iframe 内的内容) 只需要在参数中设置 isFrame: true 即可,此参数默认为 false
  • 相信大家都遇到过在多浏览器下,javascript 打印代码不是那么听话的时候,那么,有了这个组件,这都不是事儿了!此组件,基于 jQuery 1.x 编写,能完美兼容各个浏览器的打印需求!!你,值得拥有!
  • 网络打印组件

    2018-07-17 09:05:20
    网页打印组件,最新版安装软件,安装后重启• 上传的资源如果因版权、使用请停止
  • vue-print-nb 组件打印网页

    千次阅读 2020-06-17 16:23:39
    一、安装组件 npm install vue-print-nb --save 二、引入组件 import Print from "vue-print-nb"; import Vue from "vue"; Vue.use(Print); 三、使用 <div id="printMe" > <p>打印内容</...

     

    一、安装组件

    npm install vue-print-nb --save

     

    二、引入组件

    import Print from "vue-print-nb";
    import Vue from "vue";
    Vue.use(Print);

    三、使用

    <div id="printMe" >
        <p>打印内容</p>
    </div>
    <button v-print="'#printMe'">打印</button>

     四、设置打印样式

    在<style>标签里面谢样式

    @page {
      margin: 0;
    }
    @media print {
      .noprint {
        display: none;
      }
    }

    五、完整代码示例

    <template>
      <el-dialog
        :append-to-body="true"
        :close-on-click-modal="false"
        :before-close="cancel"
        :visible.sync="dialog"
        :title="isAdd ? '新增' : '订单详情'"
        width="990px"
      >
        <div id="printTest">
          <el-card>
            <div slot="header">
              <span>收货信息</span>
            </div>
            <div class="text item">用户昵称:{{ form.nickname }}</div>
            <div class="text item">收货人: {{ form.realName }}</div>
            <div class="text item">联系电话: {{ form.userPhone }}</div>
            <div class="text item">收货地址: {{ form.userAddress }}</div>
          </el-card>
          <el-card>
            <div slot="header">
              <span>订单信息</span>
            </div>
            <el-row :gutter="24">
              <el-col :span="12">
                <div class="text item">订单编号: {{ form.orderId }}</div>
                <div class="text item">商品总数: {{ form.totalNum }}</div>
                <div class="text item">支付邮费: {{ form.totalPostage }}</div>
                <div class="text item">实际支付: {{ form.payPrice }}</div>
                <div class="text item">支付方式: {{ form.payTypeName }}</div>
              </el-col>
              <el-col :span="12">
                <div class="text item">订单状态: {{ form.statusName }}</div>
                <div class="text item">商品总价: {{ form.totalPrice }}</div>
                <div class="text item">优惠券金额: {{ form.couponPrice }}</div>
                <div class="text item">创建时间: {{ formatTimeTwo(form.addTime) }}</div>
                <div class="text item">支付时间: {{ formatTimeTwo(form.payTime) }}</div>
              </el-col>
            </el-row>
          </el-card>
          <el-card>
            <div slot="header">
              <span>商品信息</span>
            </div>
            <el-row :gutter="24">
              <!--表格渲染-->
              <el-table
                v-loading="loading"
                :data="form.cartInfoList"
                size="small"
                style="width: 100%;font-size:10px;"
              >
                <el-table-column prop="cartInfoMap.productInfo.barCode" label="商品编码" />
    
                <el-table-column prop="cartInfoMap.productInfo.storeName" label="商品名称" />
                <el-table-column prop="cartInfoMap.productInfo.attrInfo.suk" label="规格" />
                <el-table-column prop="cartInfoMap.cartNum" label="销售数量" />
                <el-table-column prop="cartInfoMap.productInfo.otPrice" label="市场价格" />
                <el-table-column prop="cartInfoMap.productInfo.price" label="呐喊价格" />
                
                <el-table-column label="库存">
                  <template slot-scope="scope">
                    <span
                      v-if="scope.row.cartInfoMap.productInfo.stock != '点击查看'"
                    >{{scope.row.cartInfoMap.productInfo.stock}}</span>
                    <span>
                      <el-button
                        v-if="scope.row.cartInfoMap.productInfo.stock == '点击查看'"
                        size="mini"
                        @click="showStock(scope.row)"
                      >查库存</el-button>
                    </span>
                  </template>
                </el-table-column>
              </el-table>
            </el-row>
          </el-card>
    
          <el-card>
            <div slot="header">
              <span>物流信息</span>
            </div>
            <div class="text item">快递公司:{{ form.deliveryName }}</div>
            <div class="text item">快递单号:{{ form.deliveryId }}</div>
          </el-card>
          <el-card>
            <div slot="header">
              <span>备注信息</span>
            </div>
            <div class="text item">{{ form.remark }}</div>
          </el-card>
          <el-card>
            <div slot="header">
              <span>客户备注信息</span>
            </div>
            <div class="text item">{{ form.mark }}</div>
          </el-card>
          
        </div>
        <span slot="footer" class="dialog-footer noprint">
            <el-button @click="dialog = false">关 闭</el-button>
            <el-button type="primary" v-print="'#printTest'">打 印</el-button>
          </span>
      </el-dialog>
    </template>
    
    <script>
    import { add, edit, levelPriceList } from "@/api/yxStoreOrder";
    import { formatTimeTwo } from "@/utils/index";
    import { detail } from "@/api/yxStoreProduct";
    import Print from "vue-print-nb";
    import Vue from "vue";
    Vue.use(Print);
    export default {
      components: {
        Print
      },
      props: {
        isAdd: {
          type: Boolean,
          required: true
        }
      },
      data() {
        return {
          loading: false,
          dialog: false,
          form: {
            id: "",
            orderId: "",
            uid: "",
            realName: "",
            userPhone: "",
            userAddress: "",
            cartId: "",
            freightPrice: "",
            totalNum: "",
            totalPrice: "",
            totalPostage: "",
            payPrice: "",
            payPostage: "",
            deductionPrice: "",
            couponId: "",
            couponPrice: "",
            paid: "",
            payTime: "",
            payType: "",
            addTime: "",
            status: "",
            refundStatus: "",
            refundReasonWapImg: "",
            refundReasonWapExplain: "",
            refundReasonTime: "",
            refundReasonWap: "",
            refundReason: "",
            refundPrice: "",
            deliveryName: "",
            deliveryType: "",
            deliveryId: "",
            gainIntegral: "",
            useIntegral: "",
            backIntegral: "",
            mark: "",
            isDel: "",
            unique: "",
            remark: "",
            merId: "",
            isMerCheck: "",
            combinationId: "",
            pinkId: "",
            cost: "",
            seckillId: "",
            bargainId: "",
            verifyCode: "",
            storeId: "",
            shippingType: "",
            isChannel: "",
            isRemind: "",
            isSystemDel: ""
          },
          rules: {
            unique: [{ required: true, message: "please enter", trigger: "blur" }]
          }
        };
      },
      methods: {
        formatTimeTwo,
        showStock(row) {
          detail(row.cartInfoMap.productInfo.id).then(res => {
            row.cartInfoMap.productInfo.stock = res.stock;
          });
        },
        cancel() {
          this.resetForm();
        },
        doSubmit() {
          this.loading = true;
          if (this.isAdd) {
            this.doAdd();
          } else this.doEdit();
        },
        doAdd() {
          add(this.form)
            .then(res => {
              this.resetForm();
              this.$notify({
                title: "添加成功",
                type: "success",
                duration: 2500
              });
              this.loading = false;
              this.$parent.init();
            })
            .catch(err => {
              this.loading = false;
              console.log(err.response.data.message);
            });
        },
        doEdit() {
          edit(this.form)
            .then(res => {
              this.resetForm();
              this.$notify({
                title: "修改成功",
                type: "success",
                duration: 2500
              });
              this.loading = false;
              this.$parent.init();
            })
            .catch(err => {
              this.loading = false;
              console.log(err.response.data.message);
            });
        },
        resetForm() {
          this.dialog = false;
          this.form = {
            id: "",
            orderId: "",
            uid: "",
            realName: "",
            userPhone: "",
            userAddress: "",
            cartId: "",
            freightPrice: "",
            totalNum: "",
            totalPrice: "",
            totalPostage: "",
            payPrice: "",
            payPostage: "",
            deductionPrice: "",
            couponId: "",
            couponPrice: "",
            paid: "",
            payTime: "",
            payType: "",
            addTime: "",
            status: "",
            refundStatus: "",
            refundReasonWapImg: "",
            refundReasonWapExplain: "",
            refundReasonTime: "",
            refundReasonWap: "",
            refundReason: "",
            refundPrice: "",
            deliveryName: "",
            deliveryType: "",
            deliveryId: "",
            gainIntegral: "",
            useIntegral: "",
            backIntegral: "",
            mark: "",
            isDel: "",
            unique: "",
            remark: "",
            merId: "",
            isMerCheck: "",
            combinationId: "",
            pinkId: "",
            cost: "",
            seckillId: "",
            bargainId: "",
            verifyCode: "",
            storeId: "",
            shippingType: "",
            isChannel: "",
            isRemind: "",
            isSystemDel: ""
          };
        }
      }
    };
    </script>
    
    <style scoped>
    @page {
      margin: 0;
    }
    @media print {
      .noprint {
        display: none;
      }
    }
    
    .text {
      font-size: 12px;
    }
    
    .item {
      padding: 6px 0;
    }
    </style>
    

    六、遇到的问题

    遇到了几个问题 这里列出来

    1、无法加载组件

    后台报错 : [Vue warn]: Failed to resolve directive: print

    解决办法

    先引入Vue

    再调用 Vue.use(Print);

    import Print from "vue-print-nb";
    import Vue from "vue";
    Vue.use(Print);

    2、打印内容不全,显示滚动条

    在页面中显示正常,打印预览的时候内容显示不全,显示滚动条,并且不分页

    解决办法

    使用css控制打印样式

    @page {
      margin: 0;
    }
    @media print {
      .noprint {
        display: none;
      }
    }

    背景色不能打印

    在需要背景色的标签上面加上这个样色即可

    .value {
        -webkit-print-color-adjust: exact;
        background-color: #eee;
        padding: 8px;
        font-size: 12px;
        min-width: 80px;
      }

    打印多一页空白页

    检查要打印的标签是不是用margin属性,margin属性会导致多一页空白页面。有的话想办法用padding来实现相同显示效果。

     

     

     

     

    展开全文
  • 菜鸟谷歌浏览器打印组件技术分析

    千次阅读 2019-01-25 10:18:44
    之前一直在研究浏览器调用本地程序,但发现似乎只有IE的OCX才能做到,谷歌浏览器虽然说有插件,但实现IE下OCX的功能却不太可能,忽然有一天,有个同事让我看一下菜鸟的打印组件,豁然开朗。  菜鸟的打印组件竟然是...

    之前一直在研究浏览器调用本地程序,但发现似乎只有IE的OCX才能做到,谷歌浏览器虽然说有插件,但实现IE下OCX的功能却不太可能,忽然有一天,有个同事让我看一下菜鸟的打印组件,豁然开朗。

     菜鸟的打印组件竟然是在谷歌浏览器下实现了类似IE下的OCX技术,直接可以调用打印机,但分析发现,浏览器扩展根本没有安装新东西,说明菜鸟的打印组件根本不是通过谷歌浏览器的插件机制实现的。

    无奈只能分析打印按钮的HMTL代码  

     没有行内脚本,猜测应该是根据类选择器printBtn J_printBtn 处理的点击事件,于是保存了一份网页,在下载中的中脚本中查看可能的点击事件,竟然在newWaybillPrint.js文件中找到了可能的代码

    $("body").undelegate(".J_printBtn", "click").delegate(".J_printBtn", "click", function (e) {
    				if (!J.printBtnFlag)
    					return !1;
    				var t = $(e.currentTarget),
    				a = t.attr("data-id");
    				"undefined" != typeof socket ? J.socketReadyState = socket.readyState : x._doConnect(),
    				0 == J.socketReadyState ? (J.printBtnFlag = !0, m.Alert("webSocket\u8fde\u63a5\u6b63\u5728\u5efa\u7acb", "info")) : 2 == J.socketReadyState ? (J.printBtnFlag = !0, m.Alert("webSocket\u8fde\u63a5\u6b63\u5728\u8fdb\u884c\u5173\u95ed", "info")) : 3 == J.socketReadyState ? (J.printBtnFlag = !0, null == J.notInitOrOpenDialog && x._renderNotInitPrintDialog(), J.notInitOrOpenDialog.show()) : (J.printBtnFlag = !1, x._printViewDialog("single"), J.previewDialog.root.attr("data-curId", a), J.previewDialog.show())
    			}),

    在浏览器中调试,明显是压缩过的代码,但点击红色部分,可以格式化,并添加断点,调试,果然是。

     

     发现有一个    "undefined" != typeof socket ? J.socketReadyState = socket.readyState : x._doConnect(),

    然后在分析socket,找到了

    _doConnect: function () {
    			var e = window.location,
    			t = "",
    			a = "";
    			if ("https:" === e.protocol ? (t = "wss:", a = "13529") : (t = "ws:", a = "13528"), window.WebSocket)
    				window.socket = new WebSocket(t + "//localhost:" + a), socket.onopen = function (e) {
    					J.socketReadyState = e.target.readyState,
    					x._doGetPrinters("123")
    				},

    竟然是通过WebSocket和本地的打印程序通讯,然后就可以调用本地资源了。感觉真的是太巧妙了。把打印程序作为WebSocket的服务端,这样就实现了通过浏览器调用本地资源的功能,实现了B/S,C/S巧妙结合的使用,充分合理利用了B/S,C/S的好处。

    客户端浏览器和打印程序之间通过WebSocket进行交互

    浏览器和菜鸟服务器是正常的BS程序

    打印程序和和菜鸟服务器是正常的CS程序

    简单的网页通讯代码

    <!DOCTYPE html>
    <html>
       <head>
          <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />  
     <style type="text/css">body * 
    {
    font-family:微软雅黑;font-size:14px
    }
     </style> 
           <script type="text/javascript">
    
    
             var websocket = null;
         //判断当前浏览器是否支持WebSocket
         if ('WebSocket' in window) {
             websocket = new WebSocket("ws://localhost:8181");
         }
         else {
             alert('当前浏览器 Not support websocket')
         }
     
         //连接发生错误的回调方法
         websocket.onerror = function () {
             setMessageInnerHTML("WebSocket连接发生错误");
         };
     
         //连接成功建立的回调方法
         websocket.onopen = function () {
             //        setMessageInnerHTML("WebSocket连接成功");
             websocket.send("WebSocket连接成功");
         }
     
         //接收到消息的回调方法
         websocket.onmessage = function (event) {
             setMessageInnerHTML(event.data);
         }
     
         //连接关闭的回调方法
         websocket.onclose = function () {
             setMessageInnerHTML("WebSocket连接关闭");
         }
     
     
         //监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
     
         window.onbeforeunload = function () {
     
             closeWebSocket();
     
         }
     
         //将消息显示在网页上
     
         function setMessageInnerHTML(innerHTML) {
     
             document.getElementById('message').innerHTML +="收到消息:"+ innerHTML + '<br/>';
     
         }
     
         function closeWebSocket() {
     
             websocket.close();
     
         }
     
     
         function clear(){
             document.getElementById('message').innerHTML="";
         }
     
         //发送消息
     
         function send() {
     
             var message = document.getElementById('text').value;
     
             websocket.send(message);
     
         }
    </script> 
    </head>
       <body  style="padding:0px;width:1015px">
           <button onclick="closeWebSocket()">关闭WebSocket连接</button>
           <button onclick="clear()">清空</button>
           <hr />
           <input type="text" id="text" />
           <button onclick="send()">发送消息</button>
           <div id="message"></div>
    </body>
    </html>

    使用Csharp插件Fleck编写的简单的模拟打印程序

    using Fleck;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace WindowsFormsWebSocket
    {
        public partial class Form1 : Form
        {
            WebSocketServer server = null;
          //  IWebSocketConnection client = null;
            Dictionary<Guid, IWebSocketConnection> dic = new Dictionary<Guid, IWebSocketConnection>();
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                server = new WebSocketServer("ws://127.0.0.1:8181");
                server.RestartAfterListenError = true;
                server.Start(socket =>
                {
                    socket.OnOpen = () => OnOpen(socket);
                    socket.OnClose = () => OnClose(socket);
                    socket.OnMessage = m => OnMessage(socket, m);
                });
            }
    
            private void OnMessage(IWebSocketConnection socket, string m)
            {
                MessageBox.Show("收到客户端消息:"+m);
               // throw new NotImplementedException();
            }
    
            private void OnClose(IWebSocketConnection socket)
            {
                Guid id = socket.ConnectionInfo.Id;
                if(dic.ContainsKey(id))
                {
                    IWebSocketConnection sond= dic[id];
                    sond.Close();
                    dic.Remove(id);
                }         
                MessageBox.Show("OnClose");
            }
    
            private void OnOpen(IWebSocketConnection socket)
            {
                Guid id = socket.ConnectionInfo.Id;
                if (dic.ContainsKey(id))
                {
                    IWebSocketConnection sond = dic[id];
                    sond.Close();
                    dic.Remove(id);
                }
                else
                {
                    dic[id] = socket;
                }          
            }
    
            private void button1_Click(object sender, EventArgs e)
            {   
               string text= textBox1.Text;
                foreach(var i in dic)
                {
                    IWebSocketConnection sond = i.Value;
                    sond.Send(text);
                }          
            }
        }
    }
    

    .NET 的 WebSocket 开发包比较(转)

    C# 实现WebSocket服务端实例

    Writing a WebSocket server in C#

    The simple WebSocket application in ASP.NET

    在IIS上搭建WebSocket服务器

    C# Websocket Implementation

    史上最全Web端即时通讯技术原理详解

    WebSocket

    HTML5 WebSocket

    关于websocket兼容IE版本

    展开全文
  • WEB打印组件,支持64位操作系统,内有详细说明及实例
  • vue项目中使用菜鸟打印组件

    千次阅读 2021-01-18 09:32:05
    最近项目中要对接订单信息,打印快递面单。这里记录下开发流程。 前端方面流程还是很简单的。 1.电脑安装 连接好打印机 并安装对应打印机驱动 ...3.在开始打印前 要注意你的快递面单尺寸,在打印组件中需要设置对...

    最近项目中要对接订单信息,打印快递面单。这里记录下开发流程。

    前端方面流程还是很简单的。

    1.电脑安装 连接好打印机  并安装对应打印机驱动   

    2.电脑安装 菜鸟打印组件   
      下载地址:http://cloudprint.cainiao.com/cloudprint/client/CNPrintSetup.exe?spm=a219a.7629140.0.0.YJQX7O&file=CNPrintSetup.exe

    3.在开始打印前 要注意你的快递面单尺寸,在打印组件中需要设置对应打印机的纸张尺寸

    4.现在开始使用代码打印了

    文档:
    https://support-cnkuaidi.taobao.com/doc.htm?spm=a219a.7386653.0.0.21b7669azYzG1r#?docId=107014&docType=1&qq-pf-to=pcqq.c2c

    下面贴上我的代码:

    <template>
      <div>
        <el-button @click="onStart">打印</el-button>
        <el-button @click="getPrints">获取打印机列表</el-button>
        <el-button @click="setPrinterConfig">设置打印机配置</el-button>
        <el-button @click="getPrinterConfig">获取打印机配置</el-button>
        <el-button @click="getExpressCompaniesPrinter">获取快递设置的打印机</el-button>
      </div>
    </template>
    
    <script>
    
      let socket, defaultPrinter;
      let num = [{
        waybillCode: "3738460008834",
        printData: {
          data: '',
          // templateURL: 'http://cloudprint.cainiao.com/template/standard/101/123'
          templateURL: 'http://cloudprint.cainiao.com/template/standard/101/635'
        },
        objectId: "1"
      }];
      let jsonObject = {
        content: {
          "data": {
            "_dataFrom": "waybill",
            "adsInfo": {
              "adId": "556",
              "advertisementType": "COMMERCIAL",
              "bannerUrl": "http://ad-cdn.cainiao.com/361/1607308583670.JPG",
              "miniBannerUrl": "http://ad-cdn.cainiao.com/361/1607308576681.JPG",
              "trackUrl": "https://ad.cainiao.com/9kESOzk"
            },
            "cpCode": "ZTO",        //不同快递 cpCode不同
            "needEncrypt": false,
            "packageInfo": {
              "currentPackageSequence": 0,
              "id": "-1",
              "totalPackagesCount": 0,
              "volume": 0,
              "weight": 0
            },
            "parent": false,
            "recipient": {
              "address": {
                "city": "杭州市",
                "detail": "文一西路969号",
                "district": "余杭区",
                "province": "浙江省"
              },
              "mobile": "13100000001",
              "name": "李四"
            },
            "routingInfo": {
              "blockCode": "969",
              "consolidation": {
                "code": "571901"
              },
              "origin": {
                "code": "731091",
                "name": "湖南省长沙市岳麓三部"
              },
              "receiveBranch": {
                "code": "571937",
                "name": "浙江省杭州市余杭区桃花港直营"
              },
              "routeCode": "342-075-00 250",
              "sortation": {
                "name": "余杭"
              },
              "startCenter": {},
              "terminalCenter": {
                "code": "571901",
                "name": "杭州转运中心"
              }
            },
            "sender": {
              "address": {
                "city": "长沙市",
                "detail": "东方红中路175号",
                "district": "岳麓区",
                "province": "湖南省"
              },
              "mobile": "13000000000",
              "name": "张三"
            },
            "shippingOption": {
              "code": "STANDARD_EXPRESS",
              "title": "标准快递"
            },
            "waybillCode": "YT5202203890344"
          },
          "signature": "MD:U1Pw5p49tvW2JMD0HlRIEA==",
          //templateURL  每个快递的模板都不同
          "templateURL":"http://cloudprint.cainiao.com/template/standard/308812/7"
    
        }
        
      };
      export default {
        name: "frm_orders_ship",
        mounted() {
          const that = this;
          socket = new WebSocket('ws://127.0.0.1:13528');
          socket.onopen = function (event) {
    
            // 监听消息
            socket.onmessage = function (event) {
              console.log('Client received a message', event);
              console.log(JSON.parse(event.data).defaultPrinter);
              defaultPrinter = JSON.parse(event.data).defaultPrinter;
              that.subscribe(JSON.parse(event.data))
            };
            // 监听Socket的关闭
            socket.onclose = function (event) {
              console.log('Client notified socket has closed', event);
            };
          };
        },
        methods: {
          subscribe: function (data) {
            switch (data.cmd) {
              case 'getPrinters':
                console.log("获取打印机列表");
                console.log(data.printers);
                break;
              case 'getPrinterConfig':
                console.log("获取打印机配置");
                console.log(data.printer);
                break;
              case 'print':
                console.log("发送打印");
                console.log(data);
                break;
              case 'notifyPrintResult':
                console.log("打印通知");
                console.log(data);
                break;
              case 'setPrinterConfig':
                console.log("设置打印机配置");
                console.log(data);
                break;
            }
          },
          getPrints: function () {
            this.getPrintList()//打印机列表
          },
          getExpressCompaniesPrinter: function () {
            let express_companies_printer = localStorage.getItem("rmt_set_express_companies_printer");
            console.log(express_companies_printer)
          },
          getPrinterConfig: function () {
            let request = this.getRequestObject("getPrinterConfig");
            request.printer = "KM-118";
            if (socket.readyState === 1) {
              console.log(request);
              socket.send(JSON.stringify(request));
            }
          },
          setPrinterConfig: function () {
            let request = this.getRequestObject("setPrinterConfig");
            request.printer = {
              "name": "KM-118",
              "needTopLogo": true
            }
            if (socket.readyState === 1) {
              console.log(request)
              socket.send(JSON.stringify(request));
            }
          },
          onStart: function () {
            this.doPrint(defaultPrinter, num)
          },
          getPrintList: function () {
            let request = this.getRequestObject("getPrinters");
    
            if (socket.readyState === 1) {
              console.log(request)
              socket.send(JSON.stringify(request));
            }
          },
          getRequestObject: function (cmd) {
            let request = new Object();
            request.requestID = this.getUUID(8, 16);
            request.version = "1.0";
            request.cmd = cmd;
            return request;
          },
          getUUID: function (len, radix) {
            let chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
            let uuid = [], i;
            radix = radix || chars.length;
            if (len) {
              for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
            } else {
              let r;
              uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
              uuid[14] = '4';
              for (i = 0; i < 36; i++) {
                if (!uuid[i]) {
                  r = 0 | Math.random() * 16;
                  uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
                }
              }
            }
            return uuid.join('');
          },
    
          //printer 指定打印机
          doPrint: function (printer, waybillArray) {
            let request = this.getRequestObject("print");
            request.task = new Object();
            request.task.taskID = this.getUUID(8, 10);
            request.task.preview = false;
            request.task.printer = printer;
            let documents = new Array();
            for (let i = 0; i < waybillArray.length; i++) {
              let doc = new Object();
              doc.documentID = waybillArray[i];
              let content = new Array();
              let waybillJson = this.getWaybillJson(waybillArray[i]);
              let customAreaData = this.getCustomAreaData(waybillArray[i]);
              content.push(waybillJson, customAreaData);
              doc.contents = content;
              documents.push(doc);
            }
            request.task.documents = documents
            socket.send(JSON.stringify(request));
          },
          getWaybillJson: function (waybillNO) {
            //获取waybill对应的json object,此处的ajaxGet函数是伪代码
            // let jsonObject = ajaxGet(waybillNO);
            return jsonObject;
          },
          getCustomAreaData: function (waybillNO) {
            //获取waybill对应的自定义区的JSON object,此处的ajaxGet函数是伪代码
            // let jsonObject = ajaxGet(waybillNO);
            let ret = new Object();
            ret.templateURL = jsonObject.content.templateURL;
            ret.data = jsonObject.content.data;
            return ret;
          }
        }
      }
    </script>
    
    <style scoped>
    
    </style>
    

    不同快递的模板都不相同,当然可以在自己的菜鸟服务平台自定义模板。下面贴上多家快递定义好的模板,自定义的时候可以将这些模板里面的代码copy过去,修改下就ok拉

    {
        "data": [
            {
                "cpCode": "ZTKY",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "4",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/407120/1",
                        "standardTemplateName": "中铁快运标准面单"
                    }
                ]
            },
            {
                "cpCode": "GTO",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1101/109",
                        "standardTemplateName": "国通快递标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75504/30",
                        "standardTemplateName": "国通快递标准三联模板"
                    }
                ]
            },
            {
                "cpCode": "5000000007756",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/82710/25",
                        "standardTemplateName": "中国邮政国内标快标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/84011/26",
                        "standardTemplateName": "中国邮政国内标快标准三联模板"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/288617/4",
                        "standardTemplateName": "中国邮政国内标快便携式模板"
                    }
                ]
            },
            {
                "cpCode": "DBKD",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1301/123",
                        "standardTemplateName": "德邦快递标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75304/39",
                        "standardTemplateName": "德邦快递标准三联模板"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286604/5",
                        "standardTemplateName": "德邦快递便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286355/3",
                        "standardTemplateName": "德邦快递标准模板(蓝牙版)"
                    },
                    {
                        "standardWaybillType": "6",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/293905/21",
                        "standardTemplateName": "德邦一联单模板"
                    },
                    {
                        "standardWaybillType": "8",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/300104/9",
                        "standardTemplateName": "德邦快递蓝牙一联单"
                    }
                ]
            },
            {
                "cpCode": "QFKD",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1401/120",
                        "standardTemplateName": "全峰快递标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/76802/31",
                        "standardTemplateName": "全峰快递标准三联模板"
                    }
                ]
            },
            {
                "cpCode": "2460304407_385",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/190602/7",
                        "standardTemplateName": "远成快运三联标准模板"
                    },
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/190302/8",
                        "standardTemplateName": "远成快运标准模板"
                    }
                ]
            },
            {
                "cpCode": "UC",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1001/135",
                        "standardTemplateName": "优速快递标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75105/41",
                        "standardTemplateName": "优速快递标准三联模板"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286605/5",
                        "standardTemplateName": "优速快递便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286187/3",
                        "standardTemplateName": "优速快递标准模板(蓝牙版)"
                    }
                ]
            },
            {
                "cpCode": "STO",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/201/211",
                        "standardTemplateName": "申通快递标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75402/54",
                        "standardTemplateName": "申通快递标准三联模板"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/269738/14",
                        "standardTemplateName": "申通快递便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285415/4",
                        "standardTemplateName": "申通快递标准模板(蓝牙版)"
                    },
                    {
                        "standardWaybillType": "6",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/288948/49",
                        "standardTemplateName": "申通快递一联单"
                    },
                    {
                        "standardWaybillType": "8",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/300002/14",
                        "standardTemplateName": "申通蓝牙一联单"
                    }
                ]
            },
            {
                "cpCode": "EYB",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1601/124",
                        "standardTemplateName": "EMS经济快递标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75404/29",
                        "standardTemplateName": "EMS经济快递标准三联模板"
                    }
                ]
            },
            {
                "cpCode": "CP457538",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "4",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285042/3",
                        "standardTemplateName": "卡行天下快运标准模板"
                    }
                ]
            },
            {
                "cpCode": "SF",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1501/69",
                        "standardTemplateName": "顺丰速运标准模板"
                    }
                ]
            },
            {
                "cpCode": "ZTO",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/301/221",
                        "standardTemplateName": "中通快递标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/74805/47",
                        "standardTemplateName": "中通快递标准三联模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285198/2",
                        "standardTemplateName": "中通快递标准模板(蓝牙版)"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/278404/3",
                        "standardTemplateName": "中通便携式模板"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/288345/4",
                        "standardTemplateName": "中通便携式模板(高度200mm)"
                    },
                    {
                        "standardWaybillType": "6",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/300336/32",
                        "standardTemplateName": "中通一联单"
                    },
                    {
                        "standardWaybillType": "8",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/308812/7",
                        "standardTemplateName": "中通蓝牙一联单"
                    }
                ]
            },
            {
                "cpCode": "YTO",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/101/635",
                        "standardTemplateName": "圆通快递标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/72417/106",
                        "standardTemplateName": "圆通快递标准三联模板"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/269439/13",
                        "standardTemplateName": "圆通快递便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285423/10",
                        "standardTemplateName": "圆通快递标准模板(蓝牙版)"
                    },
                    {
                        "standardWaybillType": "6",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/290659/43",
                        "standardTemplateName": "圆通一联单"
                    },
                    {
                        "standardWaybillType": "8",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/300502/12",
                        "standardTemplateName": "圆通蓝牙一联单"
                    }
                ]
            },
            {
                "cpCode": "TTKDEX",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/601/162",
                        "standardTemplateName": "天天快递标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/76403/58",
                        "standardTemplateName": "天天快递标准三联模板"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/270135/15",
                        "standardTemplateName": "天天快递便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285703/2",
                        "standardTemplateName": "天天快递标准模板(蓝牙版)"
                    },
                    {
                        "standardWaybillType": "6",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/298499/17",
                        "standardTemplateName": "天天一联单"
                    },
                    {
                        "standardWaybillType": "8",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/300401/11",
                        "standardTemplateName": "天天快递蓝牙一联单"
                    }
                ]
            },
            {
                "cpCode": "SNWL",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/266904/4",
                        "standardTemplateName": "苏宁标准面单"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286484/3",
                        "standardTemplateName": "苏宁快递便携式模板"
                    }
                ]
            },
            {
                "cpCode": "CN7000001017817",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/238398/3",
                        "standardTemplateName": "申通快运标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/238614/4",
                        "standardTemplateName": "申通快运三联模板"
                    }
                ]
            },
            {
                "cpCode": "HOAU",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "4",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/291152/15",
                        "standardTemplateName": "天地华宇快运"
                    }
                ]
            },
            {
                "cpCode": "HTKY",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/501/168",
                        "standardTemplateName": "百世快递标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/74606/49",
                        "standardTemplateName": "百世快递标准三联模板"
                    },
                    {
                        "standardWaybillType": "6",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/278716/35",
                        "standardTemplateName": "百世快递一联单(新)"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/278380/8",
                        "standardTemplateName": "百世快递便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285199/4",
                        "standardTemplateName": "百世快递标准模板(蓝牙版)"
                    }
                ]
            },
            {
                "cpCode": "100004928",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/34725/47",
                        "standardTemplateName": "如风达标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75603/23",
                        "standardTemplateName": "如风达标准三联模板"
                    }
                ]
            },
            {
                "cpCode": "CN7000001009020",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/194938/6",
                        "standardTemplateName": "德邦快运标准模板(即将下线)"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/194434/5",
                        "standardTemplateName": "德邦快运三联模板(即将下线)"
                    },
                    {
                        "standardWaybillType": "4",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/250621/4",
                        "standardTemplateName": "德邦快递(物流)"
                    }
                ]
            },
            {
                "cpCode": "CP443514",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/280999/1",
                        "standardTemplateName": "百世云配标准面单"
                    }
                ]
            },
            {
                "cpCode": "YUNDA",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/401/198",
                        "standardTemplateName": "韵达快递标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/76303/59",
                        "standardTemplateName": "韵达快递标准三联模板"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/278831/13",
                        "standardTemplateName": "韵达快递便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/285424/5",
                        "standardTemplateName": "韵达快递标准模板(蓝牙版)"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/288357/3",
                        "standardTemplateName": "韵达便携式(高度160)"
                    },
                    {
                        "standardWaybillType": "6",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/288658/29",
                        "standardTemplateName": "韵达快递一联单"
                    },
                    {
                        "standardWaybillType": "8",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/300202/16",
                        "standardTemplateName": "韵达蓝牙一联单"
                    }
                ]
            },
            {
                "cpCode": "ZJS",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/901/130",
                        "standardTemplateName": "宅急送标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75104/28",
                        "standardTemplateName": "宅急送标准三联模板"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286607/5",
                        "standardTemplateName": "宅急送快递便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286705/1",
                        "standardTemplateName": "宅急送快递标准模板(蓝牙版)"
                    },
                    {
                        "standardWaybillType": "6",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/309188/4",
                        "standardTemplateName": "宅急送一联单"
                    }
                ]
            },
            {
                "cpCode": "FEDEX",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/261503/4",
                        "standardTemplateName": "联邦快递标准面单"
                    }
                ]
            },
            {
                "cpCode": "3108002701_1011",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/191833/8",
                        "standardTemplateName": "中通快运标准模板(即将下线)"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/192140/5",
                        "standardTemplateName": "中通快运三联模板(即将下线)"
                    },
                    {
                        "standardWaybillType": "4",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/256771/9",
                        "standardTemplateName": "中通快运标准面单"
                    }
                ]
            },
            {
                "cpCode": "BESTQJT",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/83910/75",
                        "standardTemplateName": "百世快运标准三联模板(即将下线)"
                    },
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/84010/27",
                        "standardTemplateName": "百世快运标准模板(即将下线)"
                    },
                    {
                        "standardWaybillType": "4",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/250934/8",
                        "standardTemplateName": "百世快运(电商)"
                    }
                ]
            },
            {
                "cpCode": "CP471906",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "4",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/327512/1",
                        "standardTemplateName": "顺心捷达快运标准面单"
                    }
                ]
            },
            {
                "cpCode": "CN7000001000869",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "4",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/251315/6",
                        "standardTemplateName": "安能快运"
                    }
                ]
            },
            {
                "cpCode": "2744832184_543",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "4",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/251413/6",
                        "standardTemplateName": "壹米滴答"
                    }
                ]
            },
            {
                "cpCode": "EMS",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/701/137",
                        "standardTemplateName": "EMS标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/76503/40",
                        "standardTemplateName": "EMS标准三联模板"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286353/6",
                        "standardTemplateName": "EMS快递便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286356/1",
                        "standardTemplateName": "EMS快递标准模板(蓝牙版)"
                    },
                    {
                        "standardWaybillType": "6",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/345208/2",
                        "standardTemplateName": "EMS一联单"
                    }
                ]
            },
            {
                "cpCode": "XFWL",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/249128/7",
                        "standardTemplateName": "信丰物流标准二联模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/249422/7",
                        "standardTemplateName": "信丰物流三联模板"
                    }
                ]
            },
            {
                "cpCode": "2383545689_32",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/188729/9",
                        "standardTemplateName": "九曳标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/188817/7",
                        "standardTemplateName": "九曳标准三联模板"
                    }
                ]
            },
            {
                "cpCode": "POSTB",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/801/148",
                        "standardTemplateName": "中国邮政快递包裹标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/75704/41",
                        "standardTemplateName": "中国邮政快递包裹标准三联模板"
                    },
                    {
                        "standardWaybillType": "6",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/275609/14",
                        "standardTemplateName": "中国邮政快递包裹一联单"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286704/5",
                        "standardTemplateName": "中国邮政快递包裹便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286357/1",
                        "standardTemplateName": "中国邮政快递包裹标准面单(蓝牙版)"
                    },
                    {
                        "standardWaybillType": "6",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/304351/5",
                        "standardTemplateName": "快递包裹一联单(高度130)"
                    },
                    {
                        "standardWaybillType": "8",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/308720/5",
                        "standardTemplateName": "邮政包裹蓝牙一联单"
                    }
                ]
            },
            {
                "cpCode": "CN7000001021040",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "4",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/256622/10",
                        "standardTemplateName": "韵达快运标准面单"
                    }
                ]
            },
            {
                "cpCode": "CN7000001003751",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/181603/10",
                        "standardTemplateName": "跨越速运标准模版"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/182004/9",
                        "standardTemplateName": "跨越速运标准三联模版"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286606/5",
                        "standardTemplateName": "跨越速运便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/286188/2",
                        "standardTemplateName": "跨越速运标准模板(蓝牙版)"
                    }
                ]
            },
            {
                "cpCode": "100007887",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/248932/3",
                        "standardTemplateName": "递速物流标准二联模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/249423/3",
                        "standardTemplateName": "递速物流三联模板"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/290472/1",
                        "standardTemplateName": "递速物流便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/290473/1",
                        "standardTemplateName": "递速蓝牙标准模板"
                    }
                ]
            },
            {
                "cpCode": "SURE",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "4",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/281280/3",
                        "standardTemplateName": "速尔快递一票多件"
                    }
                ]
            },
            {
                "cpCode": "CP570969",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/279710/6",
                        "standardTemplateName": "丹鸟二联模板"
                    },
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/309239/1",
                        "standardTemplateName": "丹鸟外单"
                    },
                    {
                        "standardWaybillType": "8",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/393904/3",
                        "standardTemplateName": "蓝牙丹鸟一联单"
                    }
                ]
            },
            {
                "cpCode": "2608021499_235",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/183119/10",
                        "standardTemplateName": "安能快递标准模版"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/183020/9",
                        "standardTemplateName": "安能快递标准三联模版"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/288514/4",
                        "standardTemplateName": "安能快递便携式模板"
                    },
                    {
                        "standardWaybillType": "7",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/289106/1",
                        "standardTemplateName": "安能快递标准模板(蓝牙版)"
                    }
                ]
            },
            {
                "cpCode": "CP446169",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "4",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/403974/1",
                        "standardTemplateName": "加运美快运二联单"
                    }
                ]
            },
            {
                "cpCode": "CP468398",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/272031/4",
                        "standardTemplateName": "圆通承诺达二联模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/272141/4",
                        "standardTemplateName": "圆通承诺达三联模板"
                    },
                    {
                        "standardWaybillType": "3",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/283369/8",
                        "standardTemplateName": "承诺达便携式模板"
                    }
                ]
            },
            {
                "cpCode": "FAST",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/1201/108",
                        "standardTemplateName": "快捷快递标准模板"
                    },
                    {
                        "standardWaybillType": "2",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/74806/31",
                        "standardTemplateName": "快捷快递标准三联模板"
                    }
                ]
            },
            {
                "cpCode": "CP449455",
                "standardTemplateDOs": [
                    {
                        "standardWaybillType": "1",
                        "standardTemplateUrl": "http://cloudprint.cainiao.com/template/standard/403585/1",
                        "standardTemplateName": "京广速递二联单"
                    }
                ]
            }
        ],
        "success": "true"
    }
    
    

     

    展开全文
  • 1、菜鸟打印组件支持哪些浏览器?* IE 11及以上* chrome 16及以上(建议使用chrome的最新版本)* Firefox45及以上(建议使用firefox的最新版本)*搜狗浏览器(极速模式)* 360浏览器(极速模式)* QQ浏览器(极速模式)2、我用...

    1、菜鸟打印组件支持哪些浏览器?

    * IE 11及以上

    * chrome 16及以上(建议使用chrome的最新版本)

    * Firefox45及以上(建议使用firefox的最新版本)

    *搜狗浏览器(极速模式)

    * 360浏览器(极速模式)

    * QQ浏览器(极速模式)

    a00bbffc5a750471db09fe333b93a2cf.png

    2、我用的是搜狗浏览器(或360浏览器、QQ浏览器),为什么无法打印?

    * 请尝试将这些浏览器切换到极速模式(或闪电模式),如果还是打印不了,建议使用chrome

    3、需要安装哪些软件?

    * 上述浏览器的一种或几种

    * 菜鸟打印组件

    * 预览模式下需要安装pdf软件(可选)

    4、支持的操作系统有哪些?

    * Windows XP SP3

    * Windows Vista/7/8/10

    * 上述操作系统的32位和64位均支持

    5、被杀毒软件误报(如360电脑管家)该怎么办?

    * 选择允许即可

    6、为什么打印组件桌面图标打不开,右下角没有图标,但是任务管理器进程中显示有CNPrintClient.exe进程?

    * 问题原因一

    建行网银或工行网银后台服务没有启动时影响了Windows系统导入其他程序的证书。

    * 解决方案

    第一步:“程序”→“控制面板”→“管理工具”→“服务”,或者在开始菜单直接运行services.msc

    第二步:依次选择建行“HDZB Comm Service for V2.0”和工行“ICBC Daemon Service”的系统服务程序,点击左侧的“启动此服务”;

    第三步,在任务管理器结束CNPrintClient进程,重新双击“CaiNiao打印组件”图标启动。

    * 问题原因二

    可能是系统打印机过多导致,请删除多余的打印机

    展开全文
  • 浏览器网页打印 前言 客户对于一些插件比较敏感,如金融、银行等出于安全的考虑和产品的把控,可能不愿意页面打印的时候,客户端浏览器安装插件。(当然,用户有各种各样的需求和打印格式要求,愿意使用打印...
  • 发票打印组件(web)

    2012-08-03 18:49:38
    网页打印发票,并进行发票设计!发票格式可以自定义!
  • 专为WEB打印而生 使用webSocket协议,脱离语言环境限制,主流浏览器即可支持! 精准打印 毫米精度,轻松实现POS小票,发票套打等. 多种语言 支持ASP, ASP.NET, PHP, JSP等开发语言. 超强兼容 独立运行,B/S、C/S兼容,...
  • 本文介绍JQuery插件Jqprint实现网页打印,不懂的同学正可借此机会学习下,以备不时之需,话不多说,切入主题
  • web打印组件破解版

    2008-08-02 12:37:05
    webprint破解版,有需要的下
  • js网页打印

    2013-11-16 14:58:32
    Javascript网页打印大全 普通打印(整页打) 打印网页内部分内容(自定义) 打印去掉/添加页眉页脚 使用外部控件/方法实现多功能打印 打印背景 以上为代码控制 设置“页面设置”实现打印参数设置(Window系统...
  • 网页免费打印控件JS

    2018-01-10 16:39:15
    网页免费打印控件JS网页免费打印控件JS网页免费打印控件JS网页免费打印控件JS网页免费打印控件JS
  • 网页打印控件JS版

    2018-09-05 10:11:00
    JsPrint网页打印控件,引用一个JS直接调用方法,就可打印指定的DIV内容。
  • java组件swing打印测试

    2014-09-24 16:43:16
    java组件swing打印测试,供各位大侠下载应用。
  • web、移动端实现无预览打印
  • 开源免费且稳定实用的.NET PDF打印组件itextSharp(.NET组件介绍之八)  在这个.NET组件的介绍系列中,受到了很多园友的支持,一些园友(如:数据之巅、 [秦时明月]等等这些大神 )也给我提出了对应的建议...
  • 虽然把align设置为left但还是和浏览器的左边还间隔。查看相关资料才知道,原来body里面还有一个属性leftmargin,它设置页面组件与浏览器左边的距离。...边距的另一个属性topmargin设置网页组件与浏览器页面框顶部的距
  • 网页打印没有注册

    2014-12-22 14:55:30
    江苏地方税务申报系统,申报表打印时提示没有注册,用该软件进行修复,就可以打印了。
  • 控制网页打印一般有两套方案,一套是使用免费的ie默认打印,另一种是使用第三方开发的打印组件,下面介绍的是使用ie默认打印实现通过JavaScript代码控制打印。直接上代码,里面有解释: 第一段代码,使用css控制打印...
  • 网页打印的简单实现 + window.print

    千次阅读 2016-09-18 09:33:13
    网页打印的简单实现最经在做一个web小项目的时候,需要从网页中打印出表格数据。 由于是第一次接触网页打印,所以从网络搜索了很久,鉴于项目要求的打印功能比较简单,最终放弃了诸多的开源项目,而是选择了利用...
  • 此实例代码包括了基于网页版的全套打印方式,尤其是调用ocx组件打印。对做相关打印的项目是很有用的了。
  • Javascript网页打印大全

    千次阅读 2016-10-27 23:04:50
    目录 普通打印(整页打) 打印去掉/添加页眉页脚 ...打印网页内部分内容(自定义) 用css控制 @media print .a {display:block} .b {display:hidden}把你不想打印的部分class设为b 首先在网页中添加:<OBJECT id="Web
  • 网页打印非常优秀的插件 Print.js

    万次阅读 2019-05-09 09:48:34
    前言:最近需要在网页打印,网上找了很多,刚开始使用的 lodop打印插件来打印,没有达到理想的要求,它需要下载、区分浏览器的位数来安装、在vue使用时候必须写成内部样式,在笔记本样式失效等问题,使我不得不...
  • HTML网页打印实现分页打印功能

    万次阅读 2013-06-05 15:49:45
    页面打印 /* 应用这个样式的在打印时隐藏 */ .noPrint { display: none; } /* 应用这个样式的,从那个标签结束开始另算一页,之后在遇到再起一页,以此类推 */ .page { page-break...
  • 网页打印代码

    千次阅读 2009-08-13 16:55:00
    网页打印按钮的源代码:javascript:window.print();可以用css控制,看孟老大写的。@media print.a {display:block}.b {display:hidden}好像是这样。把你不想打印的部分class设为b首先在网页中添加: VIEWASTEXT> ...
  • 最近项目需求需要使用web页面的打印功能,最开始使用window.print()直接打印能出效果,但是无法实现预览功能,并且不同的浏览器执行的效果都不一样。后面百度找到webEx……那个组件,结果在html页面可行,放到项目的...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 31,800
精华内容 12,720
关键字:

网页打印组件