精华内容
下载资源
问答
  • 实例化打印对象 this.LODOP = getLodop() // 创建一个LODOP对象 let counter = this.LODOP.GET_PRINTER_COUNT() // 获取打印机个数 for (let i = 0; i ; i++) { this.printerList.push({ // 将打印机存入printerList...

    打印如下表格(含图片)

    在这里插入图片描述

    1.在vue项目中,创建一个js文件,引入以下代码

    var CreatedOKLodop7766=null
    
    //====判断是否需要安装CLodop云打印服务器:====
    export function needCLodop(){
      try{
        var ua=navigator.userAgent
        if (ua.match(/Windows\sPhone/i) !=null) return true
        if (ua.match(/iPhone|iPod/i) != null) return true
        if (ua.match(/Android/i) != null) return true
        if (ua.match(/Edge\D?\d+/i) != null) return true
    
        var verTrident=ua.match(/Trident\D?\d+/i)
        var verIE=ua.match(/MSIE\D?\d+/i)
        var verOPR=ua.match(/OPR\D?\d+/i)
        var verFF=ua.match(/Firefox\D?\d+/i)
        var x64=ua.match(/x64/i)
        if ((verTrident==null)&&(verIE==null)&&(x64!==null))
          return true
        else if (verFF !== null) {
          verFF = verFF[0].match(/\d+/)
          if ((verFF[0]>= 42)||(x64!==null)) return true
        } else if ( verOPR !== null) {
          verOPR = verOPR[0].match(/\d+/)
          if ( verOPR[0] >= 32 ) return true
        } else if ((verTrident==null)&&(verIE==null)) {
          var verChrome=ua.match(/Chrome\D?\d+/i)
          if ( verChrome !== null ) {
            verChrome = verChrome[0].match(/\d+/)
            if (verChrome[0]>=42) return true
          }
        }
        return false
      } catch(err) {return true}
    }
    
    //====页面引用CLodop云打印必须的JS文件:====
    if (needCLodop()) {
      var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement
      var oscript = document.createElement("script")
      oscript.src ="http://localhost:8000/CLodopfuncs.js?priority=1"
      head.insertBefore( oscript,head.firstChild )
    
      //引用双端口(8000和18000)避免其中某个被占用:
      oscript = document.createElement("script")
      oscript.src ="http://localhost:18000/CLodopfuncs.js?priority=0"
      head.insertBefore( oscript,head.firstChild )
    }
    
    //====获取LODOP对象的主过程:====
    export function getLodop(oOBJECT,oEMBED){
      var strHtmInstall="<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='install_lodop32.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>"
      var strHtmUpdate="<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='install_lodop32.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>"
      var strHtm64_Install="<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='install_lodop64.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>"
      var strHtm64_Update="<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='install_lodop64.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>"
      var strHtmFireFox="<br><br><font color='#FF00FF'>(注意:如曾安装过Lodop旧版附件npActiveXPLugin,请在【工具】->【附加组件】->【扩展】中先卸它)</font>"
      var strHtmChrome="<br><br><font color='#FF00FF'>(如果此前正常,仅因浏览器升级或重安装而出问题,需重新执行以上安装)</font>"
      var strCLodopInstall="<br><font color='#FF00FF'>CLodop云打印服务(localhost本地)未安装启动!点击这里<a href='http://www.c-lodop.com/download/CLodop_Setup_for_Win32NT_https_3.008Extend.zip' target='_self'>执行安装</a>,安装后请刷新页面。</font>"
      var strCLodopUpdate="<br><font color='#FF00FF'>CLodop云打印服务需升级!点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>,升级后请刷新页面。</font>"
      var LODOP
      try{
        var isIE = (navigator.userAgent.indexOf('MSIE')>=0) || (navigator.userAgent.indexOf('Trident')>=0)
        if (needCLodop()) {
          try{ LODOP=getCLodop()} catch(err) {}
          if (!LODOP && document.readyState!=="complete") {
            alert("C-Lodop没准备好,请稍后再试!")
            return
          }
          if (!LODOP) {
            // if (isIE) document.write(strCLodopInstall) else
            // document.documentElement.innerHTML=strCLodopInstall+document.documentElement.innerHTML
            // return
          } else {
            if (CLODOP.CVERSION<"3.0.0.2") {
              if (isIE) document.write(strCLodopUpdate)
              else document.documentElement.innerHTML=strCLodopUpdate+document.documentElement.innerHTML
            }
            if (oEMBED && oEMBED.parentNode) oEMBED.parentNode.removeChild(oEMBED)
            if (oOBJECT && oOBJECT.parentNode) oOBJECT.parentNode.removeChild(oOBJECT)
          }
        } else {
          var is64IE  = isIE && (navigator.userAgent.indexOf('x64')>=0)
          //=====如果页面有Lodop就直接使用,没有则新建:==========
          if (oOBJECT!=undefined || oEMBED!=undefined) {
            if (isIE) LODOP=oOBJECT
            else LODOP=oEMBED
          } else if (CreatedOKLodop7766==null){
            LODOP=document.createElement("object")
            LODOP.setAttribute("width",0)
            LODOP.setAttribute("height",0)
            LODOP.setAttribute("style","position:absoluteleft:0pxtop:-100pxwidth:0pxheight:0px")
            if (isIE) LODOP.setAttribute("classid","clsid:2105C259-1E0C-4534-8141-A753534CB4CA")
            else LODOP.setAttribute("type","application/x-print-lodop")
            document.documentElement.appendChild(LODOP)
            CreatedOKLodop7766=LODOP
          } else LODOP=CreatedOKLodop7766
          //=====Lodop插件未安装时提示下载地址:==========
          if ((LODOP==null)||(typeof(LODOP.VERSION)=="undefined")) {
            if (navigator.userAgent.indexOf('Chrome')>=0)
              document.documentElement.innerHTML=strHtmChrome+document.documentElement.innerHTML
            if (navigator.userAgent.indexOf('Firefox')>=0)
              document.documentElement.innerHTML=strHtmFireFox+document.documentElement.innerHTML
            if (is64IE) document.write(strHtm64_Install)
            else if (isIE)   document.write(strHtmInstall)
            else document.documentElement.innerHTML=strHtmInstall+document.documentElement.innerHTML
            return LODOP
          }
        }
        if (LODOP.VERSION<"6.0") {
          if (!needCLodop()){
            if (is64IE) document.write(strHtm64_Update)
            else if (isIE) document.write(strHtmUpdate)
            else document.documentElement.innerHTML=strHtmUpdate+document.documentElement.innerHTML
          }
          return LODOP
        }
        //===如下空白位置适合调用统一功能(如注册语句、语言选择等):===
        //LODOP.SET_LICENSES("北京XXXXX公司","8xxxxxxxxxxxxx5","","")
    
        //===========================================================
        return LODOP
      } catch(err) {alert("getLodop出错:"+err)}
    }
    
    

    2.在组件中引入上步骤的js文件,{ getLodop } 是上述代码中的一个方法

    在这里插入图片描述

    3.实例化打印对象

         this.LODOP = getLodop() // 创建一个LODOP对象
         let counter = this.LODOP.GET_PRINTER_COUNT() // 获取打印机个数
         for (let i = 0; i < counter; i++) {
           this.printerList.push({  // 将打印机存入printerList数组中
             name: this.LODOP.GET_PRINTER_NAME(i),
             value: i
           })
         }
    

    即可得到打印机列表 如下:

    在这里插入图片描述

    4.准备好要打印的html,我这里是根据后端传回的数据动态生成的HTML

    var html = ''
            for (let d = 0; d < this.orderDocuments.length; d++) {
              html += `
                <h4 style="text-align: center;">发货单</h4>
                <div style="margin-top: 16px;display: flex;align-items: center;justify-content: space-around;">
                  <div>订单编号:${this.orderDocuments[d].order_sn}</div>
                  <div>成团时间:${this.orderDocuments[d].pay_time}</div>
                  <div>收件人:${this.orderDocuments[d].receiver_phone}</div>
                  <div>收件电话:${this.orderDocuments[d].receiver_phone}</div>
                </div>
                <table role="table" style="float:left;margin:0;padding:0px;width:100%;border:1px solid #000;">
                  <thead>
                  <tr>
                    <th style="border: 1px solid black" rowspan="1" type="header" name="goods_name">商品名称</th>
                    <th style="border: 1px solid black" rowspan="1" type="header" name="goods_spec">规格</th>
                    <th style="border: 1px solid black" rowspan="1" type="header" name="goods_price">单价()</th>
                    <th style="border: 1px solid black" rowspan="1" type="header" name="goods_count">数量</th>
                    <th style="border: 1px solid black" rowspan="1" type="header" name="goods_money">金额</th>
                  </tr>
                  </thead>
                  <tbody class="chris-table-body">
                  ${this.orderDocuments[d].goods.map(i => {
                    return `<tr class="chris-table-row first last" role="row">
                        <td style="border: 1px solid black" type="body" name="goods_name">${i.goods_name}</td>
                        <td style="border: 1px solid black" type="body" name="goods_spec">${i.goods_spec}</td>
                        <td style="border: 1px solid black" type="body" name="goods_price">${i.goods_price}</td>
                        <td style="border: 1px solid black" type="body" name="goods_count">${i.goods_count}</td>
                        <td style="border: 1px solid black" type="body" name="goods_money">${i.goods_money}</td>
                    </tr>`
              })}
                  </tbody>
                </table>
                <div style="margin: 8px; text-align: center" class="border">
                  <img :src="${this.orderDocuments[d].wpcode}" style="width: 100px;height: 100px;" alt="">
                </div>
              `
            }
            var body = '<body>' + html + '</body>'
    

    5.生成好数据后进行打印项配置,并打印

    		_this.LODOP.PRINT_INIT('打印发货单') //打印初始化
            _this.LODOP.SET_PRINTER_INDEX(_this.printer) //选择的打印机类型(注意这里是打印机下标,0开始的)
            _this.LODOP.SET_PRINT_STYLE('FontSize', 18) //设置对象风格
            // this.LODOP.ADD_PRINT_TEXT(50, 521, 130, 39, this.description) //增加纯文本项
            _this.LODOP.SET_PRINT_PAGESIZE(2, 0, 0, 'A4') //设定纸张大小
            _this.LODOP.SET_PRINT_MODE('PRINT_PAGE_PERCENT', '55%')//设置缩放
            _this.LODOP.SET_PREVIEW_WINDOW(2, 2, 0, 0, 0, '')//设置窗口
            _this.LODOP.ADD_PRINT_HTM(88, 20, 2000, 2000, body) // 增加超文本项(打印内容即为body内容)
            // _this.LODOP.PREVIEW() // 设置预览(如果使用预览,每次打印前会弹出预览窗口,根据需要决定是否使用)
            _this.LODOP.PRINT()
    

    6.打印效果如下

    在这里插入图片描述

    至此,一个简单的clodop就完成了,如有补充,请留言~~

    展开全文
  • 获取打印机纸张信息

    2019-10-01 14:05:29
    * 功能:得到打印机低张信息 ' * 用法:GetPaperInfo(控件名) ' * 描述:如在 form_load()中调用GetPaperInfo MSHFlexGrid1 ' *********************************************************** Public Function...
    Option Explicit
    Private Const DC_MAXEXTENT = 5
    Private Const DC_MINEXTENT = 4
    Private Const DC_PAPERNAMES = 16
    Private Const DC_PAPERS = 2
    Private Const DC_PAPERSIZE = 3
    Private Declare Function DeviceCapabilities Lib "winspool.drv" Alias "DeviceCapabilitiesA" (ByVal lpDeviceName As String, ByVal lpPort As String, ByVal iIndex As Long, lpOutput As Any, lpDevMode As Any) As Long
    Private Type POINTS
            x  As Long
            y  As Long
    End Type
    
    '***********************************************************
    '* 名称:GetPaperInfo
    '* 功能:得到打印机低张信息
    '* 用法:GetPaperInfo(控件名)
    '* 描述:如在 form_load()中调用GetPaperInfo MSHFlexGrid1
    '***********************************************************
    Public Function GetPaperInfo(Flex As MSHFlexGrid) As Boolean
    
        Dim i As Long, ret As Long
        Dim Length As Integer, Width As Integer
        Dim PaperNo() As Integer, PaperName() As String, PaperSize() As POINTS
        
        With Flex
            .FormatString = "^纸张编号|^纸张名称|^纸张长度|^纸张宽度"
            For i = 0 To .Cols - 1
                .ColWidth(i) = 1700
            Next i
            .AllowUserResizing = flexResizeColumns
            .Left = 0
        End With
            
        '支持最大打印纸:
        ret = DeviceCapabilities(Printer.DeviceName, "LPT1", DC_MAXEXTENT, ByVal 0&, ByVal 0&)
        Length = ret \ 65536
        Width = ret - Length * 65536
        
        '支持最小打印纸:
        ret = DeviceCapabilities(Printer.DeviceName, "LPT1", DC_MINEXTENT, ByVal 0&, ByVal 0&)
        Length = ret \ 65536
        Width = ret - Length * 65536
        
        '支持纸张种类数
        ret = DeviceCapabilities(Printer.DeviceName, "LPT1", DC_PAPERS, ByVal 0&, ByVal 0&)
        
        '纸张编号
        ReDim PaperNo(1 To ret) As Integer
        Call DeviceCapabilities(Printer.DeviceName, "LPT1", DC_PAPERS, PaperNo(1), ByVal 0&)
        
        '纸张名称
        Dim arrPageName() As Byte
        Dim allNames As String
        Dim lStart As Long, lEnd As Long
        ReDim PaperName(1 To ret) As String
        ReDim arrPageName(1 To ret * 64) As Byte
        Call DeviceCapabilities(Printer.DeviceName, "LPT1", DC_PAPERNAMES, arrPageName(1), ByVal 0&)
        allNames = StrConv(arrPageName, vbUnicode)
        'loop through the string and search for the names of the papers
        i = 1
        Do
            lEnd = InStr(lStart + 1, allNames, Chr$(0), vbBinaryCompare)
            If (lEnd > 0) And (lEnd - lStart - 1 > 0) Then
                PaperName(i) = Mid$(allNames, lStart + 1, lEnd - lStart - 1)
                i = i + 1
            End If
            lStart = lEnd
        Loop Until lEnd = 0
        
        '纸张尺寸
        
        ReDim PaperSize(1 To ret) As POINTS
        Call DeviceCapabilities(Printer.DeviceName, "LPT1", DC_PAPERSIZE, PaperSize(1), ByVal 0&)
        
        '显示在表格中
        For i = 1 To ret
            Flex.AddItem PaperNo(i) & vbTab & PaperName(i) & vbTab & PaperSize(i).y & vbTab & PaperSize(i).x
        Next i
        
    End Function

     

    转载于:https://www.cnblogs.com/Spacecup/p/3642833.html

    展开全文
  • 飞鹅打印机

    2021-08-06 08:59:46
    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-IdRjkoWp-1628211597239)(images/screenshot_1628125606942.png)] 下面封装的方法有打印小票、添加打印机、删除打印机 host = $host; $this...

    1、下载他的基类、并添加上命名空间、改一下类名和文件名
    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-IdRjkoWp-1628211597239)(images/screenshot_1628125606942.png)]
    下面封装的方法有打印小票、添加打印机、删除打印机

    <?php
    namespace feieyun;  
    
    class HttpClient {
        // Request vars
        var $host;
        var $port;
        var $path;
        var $method;
        var $postdata = '';
        var $cookies = array();
        var $referer;
        var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*';
        var $accept_encoding = 'gzip';
        var $accept_language = 'en-us';
        var $user_agent = 'Incutio HttpClient v0.9';
        var $timeout = 20;
        var $use_gzip = true;
        var $persist_cookies = true; 
        var $persist_referers = true; 
        var $debug = false;
        var $handle_redirects = true; 
        var $max_redirects = 5;
        var $headers_only = false;    
        var $username;
        var $password;
        var $status;
        var $headers = array();
        var $content = '';
        var $errormsg;
        var $redirect_count = 0;
        var $cookie_host = '';
        function __construct($host, $port=80) {
            $this->host = $host;
            $this->port = $port;
        }
        function get($path, $data = false) {
            $this->path = $path;
            $this->method = 'GET';
            if ($data) {
                $this->path .= '?'.$this->buildQueryString($data);
            }
            return $this->doRequest();
        }
        function post($path, $data) {
            $this->path = $path;
            $this->method = 'POST';
            $this->postdata = $this->buildQueryString($data);
            return $this->doRequest();
        }
        function buildQueryString($data) {
            $querystring = '';
            if (is_array($data)) {
                foreach ($data as $key => $val) {
                    if (is_array($val)) {
                        foreach ($val as $val2) {
                            $querystring .= urlencode($key).'='.urlencode($val2).'&';
                        }
                    } else {
                        $querystring .= urlencode($key).'='.urlencode($val).'&';
                    }
                }
                $querystring = substr($querystring, 0, -1); // Eliminate unnecessary &
            } else {
                $querystring = $data;
            }
            return $querystring;
        }
        function doRequest() {
            if (!$fp = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout)) {
                switch($errno) {
                    case -3:
                        $this->errormsg = 'Socket creation failed (-3)';
                    case -4:
                        $this->errormsg = 'DNS lookup failure (-4)';
                    case -5:
                        $this->errormsg = 'Connection refused or timed out (-5)';
                    default:
                        $this->errormsg = 'Connection failed ('.$errno.')';
                    $this->errormsg .= ' '.$errstr;
                    $this->debug($this->errormsg);
                }
                return false;
            }
            socket_set_timeout($fp, $this->timeout);
            $request = $this->buildRequest();
            $this->debug('Request', $request);
            fwrite($fp, $request);
            $this->headers = array();
            $this->content = '';
            $this->errormsg = '';
            $inHeaders = true;
            $atStart = true;
            while (!feof($fp)) {
                $line = fgets($fp, 4096);
                if ($atStart) {
                    $atStart = false;
                    if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) {
                        $this->errormsg = "Status code line invalid: ".htmlentities($line);
                        $this->debug($this->errormsg);
                        return false;
                    }
                    $http_version = $m[1]; 
                    $this->status = $m[2];
                    $status_string = $m[3];
                    $this->debug(trim($line));
                    continue;
                }
                if ($inHeaders) {
                    if (trim($line) == '') {
                        $inHeaders = false;
                        $this->debug('Received Headers', $this->headers);
                        if ($this->headers_only) {
                            break;
                        }
                        continue;
                    }
                    if (!preg_match('/([^:]+):\\s*(.*)/', $line, $m)) {
                        continue;
                    }
                    $key = strtolower(trim($m[1]));
                    $val = trim($m[2]);
                    if (isset($this->headers[$key])) {
                        if (is_array($this->headers[$key])) {
                            $this->headers[$key][] = $val;
                        } else {
                            $this->headers[$key] = array($this->headers[$key], $val);
                        }
                    } else {
                        $this->headers[$key] = $val;
                    }
                    continue;
                }
                $this->content .= $line;
            }
            fclose($fp);
            if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') {
                $this->debug('Content is gzip encoded, unzipping it');
                $this->content = substr($this->content, 10);
                $this->content = gzinflate($this->content);
            }
            if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) {
                $cookies = $this->headers['set-cookie'];
                if (!is_array($cookies)) {
                    $cookies = array($cookies);
                }
                foreach ($cookies as $cookie) {
                    if (preg_match('/([^=]+)=([^;]+);/', $cookie, $m)) {
                        $this->cookies[$m[1]] = $m[2];
                    }
                }
                $this->cookie_host = $this->host;
            }
            if ($this->persist_referers) {
                $this->debug('Persisting referer: '.$this->getRequestURL());
                $this->referer = $this->getRequestURL();
            }
            if ($this->handle_redirects) {
                if (++$this->redirect_count >= $this->max_redirects) {
                    $this->errormsg = 'Number of redirects exceeded maximum ('.$this->max_redirects.')';
                    $this->debug($this->errormsg);
                    $this->redirect_count = 0;
                    return false;
                }
                $location = isset($this->headers['location']) ? $this->headers['location'] : '';
                $uri = isset($this->headers['uri']) ? $this->headers['uri'] : '';
                if ($location || $uri) {
                    $url = parse_url($location.$uri);
                    return $this->get($url['path']);
                }
            }
            return true;
        }
        function buildRequest() {
            $headers = array();
            $headers[] = "{$this->method} {$this->path} HTTP/1.0"; 
            $headers[] = "Host: {$this->host}";
            $headers[] = "User-Agent: {$this->user_agent}";
            $headers[] = "Accept: {$this->accept}";
            if ($this->use_gzip) {
                $headers[] = "Accept-encoding: {$this->accept_encoding}";
            }
            $headers[] = "Accept-language: {$this->accept_language}";
            if ($this->referer) {
                $headers[] = "Referer: {$this->referer}";
            }
            if ($this->cookies) {
                $cookie = 'Cookie: ';
                foreach ($this->cookies as $key => $value) {
                    $cookie .= "$key=$value; ";
                }
                $headers[] = $cookie;
            }
            if ($this->username && $this->password) {
                $headers[] = 'Authorization: BASIC '.base64_encode($this->username.':'.$this->password);
            }
            if ($this->postdata) {
                $headers[] = 'Content-Type: application/x-www-form-urlencoded';
                $headers[] = 'Content-Length: '.strlen($this->postdata);
            }
            $request = implode("\r\n", $headers)."\r\n\r\n".$this->postdata;
            return $request;
        }
        function getStatus() {
            return $this->status;
        }
        function getContent() {
            return $this->content;
        }
        function getHeaders() {
            return $this->headers;
        }
        function getHeader($header) {
            $header = strtolower($header);
            if (isset($this->headers[$header])) {
                return $this->headers[$header];
            } else {
                return false;
            }
        }
        function getError() {
            return $this->errormsg;
        }
        function getCookies() {
            return $this->cookies;
        }
        function getRequestURL() {
            $url = 'https://'.$this->host;
            if ($this->port != 80) {
                $url .= ':'.$this->port;
            }            
            $url .= $this->path;
            return $url;
        }
        function setUserAgent($string) {
            $this->user_agent = $string;
        }
        function setAuthorization($username, $password) {
            $this->username = $username;
            $this->password = $password;
        }
        function setCookies($array) {
            $this->cookies = $array;
        }
        function useGzip($boolean) {
            $this->use_gzip = $boolean;
        }
        function setPersistCookies($boolean) {
            $this->persist_cookies = $boolean;
        }
        function setPersistReferers($boolean) {
            $this->persist_referers = $boolean;
        }
        function setHandleRedirects($boolean) {
            $this->handle_redirects = $boolean;
        }
        function setMaxRedirects($num) {
            $this->max_redirects = $num;
        }
        function setHeadersOnly($boolean) {
            $this->headers_only = $boolean;
        }
        function setDebug($boolean) {
            $this->debug = $boolean;
        }
        function quickGet($url) {
            $bits = parse_url($url);
            $host = $bits['host'];
            $port = isset($bits['port']) ? $bits['port'] : 80;
            $path = isset($bits['path']) ? $bits['path'] : '/';
            if (isset($bits['query'])) {
                $path .= '?'.$bits['query'];
            }
            $client = new HttpClient($host, $port);
            if (!$client->get($path)) {
                return false;
            } else {
                return $client->getContent();
            }
        }
        function quickPost($url, $data) {
            $bits = parse_url($url);
            $host = $bits['host'];
            $port = isset($bits['port']) ? $bits['port'] : 80;
            $path = isset($bits['path']) ? $bits['path'] : '/';
            $client = new HttpClient($host, $port);
            if (!$client->post($path, $data)) {
                return false;
            } else {
                return $client->getContent();
            }
        }
        function debug($msg, $object = false) {
            if ($this->debug) {
                print '<div style="border: 1px solid red; padding: 0.5em; margin: 0.5em;"><strong>HttpClient Debug:</strong> '.$msg;
                if ($object) {
                    ob_start();
                    print_r($object);
                    $content = htmlentities(ob_get_contents());
                    ob_end_clean();
                    print '<pre>'.$content.'</pre>';
                }
                print '</div>';
            }
        }   
    }
    
    ?>
    

    2、建立一个接口使用类,

    <?php
    namespace feieyun;  
    use feieyun\HttpClient;
    class Feieyun {
        protected $USER='2547895205@qq.com';//*必填*:飞鹅云后台注册账号
        protected $UKEY='m4XcfzbLwRpZXL3Z';//*必填*: 飞鹅云后台注册账号后生成的UKEY 【备注:这不是填打印机的KEY】
        protected $SN;  //*必填*:打印机编号,必须要在管理后台里添加打印机或调用API接口添加之后,才能调用API
         //以下参数不需要修改
        protected $IP='api.feieyun.cn';//接口IP或域名
        protected $PORT=80;//接口IP端口
        protected $PATH='/Api/Open/';//接口IP或域名 
        public function __construct($SN="",$USER = '',$UKEY='')
        {  
            if(!empty($SN)){
                $this->SN = $SN;
            }
            if(!empty($USER)){
                $this->USER = $USER;
            }
            if(!empty($USER)){
                $this->UKEY = $UKEY;
            } 
        }
        public function batchDel($snlistData){
            $snlist="";
            $snlistDataCount=count($snlistData);
            $i=0;
             foreach ($snlistData as $key => $value) {
                $i++; 
                if($i>=$snlistDataCount){
                    
                      $snlist .= "{$value}";
                }else{
                    
                      $snlist .= "{$value}-";
                }
                     
                     
         
             }
            //  var_dump($printerContent);die;
              $this->printerDelList($snlist);
        }
    
        //添加打印机
        /*
        使用案例
        $printerConten => 打印机编号sn(必填) # 打印机识别码key(必填) # 备注名称(选填) # 流量卡号码(选填),多台打印机请换行(\n)添加新打印机信息,每次最多100台。
         $printerData=[
                ["Sn"=>"921555411","KEY"=>"amnkatm5","remark"=>"测试","carnum"=>""],
                // ["Sn"=>"921555412","KEY"=>"amnkatm2","remark"=>"测试2","carnum"=>""],
            ];  
            
            $Feieyun=new Feieyun();
            $Feieyun->batchAdd($printerData);
        */
        public function batchAdd($printerData){
            $printerContent="";
            $printerDataCount=count($printerData);
            $i=0;
             foreach ($printerData as $key => $value) {
                $i++;
                
                $SN=$value["Sn"];
                $KEY=$value["KEY"];
                $remark=$value["remark"];
                $carnum=$value["carnum"];
                if($i>=$printerDataCount){
                    
                      $printerContent .= "{$SN}#{$KEY}#{$remark}#{$carnum}";
                }else{
                    
                      $printerContent .= "{$SN}#{$KEY}#{$remark}#{$carnum}\n";
                }
                     
                     
         
             }
            //  var_dump($printerContent);die;
              $this->printerAddlist($printerContent);
        }
        // $title,$goods,$note,$extension
         public function printReceipts($title,$goods,$note,$extension){
            
        /*
         使用案例
            $Feieyun=new Feieyun("921555411");
            $title="测试标题api".time();
            $note="测试备注api".time();
            $goods=[
                ["name"=>"测试商品","price"=>"10.00","num"=>3],
                ["name"=>"测试商品品","price"=>"10.00","num"=>3],
                ["name"=>"测试商品3测试商品2测试商品2","price"=>"10.00","num"=>3],
                ];
            $extension =[
                    ["name"=>"测试","value"=>"10.00" ], 
                    ["name"=>"测试商品1","value"=>"10.00" ], 
                    ["name"=>"时间","value"=>date("Y-m-d") ], 
                ];
            $Feieyun->printReceipts($title,$goods,$note,$extension);
        */
     
                      $content = '<CB>'.$title.'</CB><BR>';
                      $content .= '名称      单价  数量 金额<BR>';
                      $content .= '--------------------------------<BR>';
                      $total_price=0;
                      foreach ($goods as $key => $value) {
                          $numprice=$value['price']*$value['num'];
                          $total_price=$total_price+$numprice;
                          if(mb_strlen($value['name'])>=8){
                              $name=mb_substr( $value['name'],0,6,"utf-8" ) ;
                              $content .= $name."... {$value['price']}   {$value['num']}  {$numprice}<BR>";
                          }else{
                              $emptynum=8-mb_strlen($value['name']);
                               $content .= $value['name'].str_repeat('  ',$emptynum)." {$value['price']}   {$value['num']}  {$numprice}<BR>";
                          }
                         
                      }
                      
                      $content .= "备注:{$note}<BR>";
                      $content .= '--------------------------------<BR>';
                      $content .= "合计:{$total_price}元<BR>";
                      foreach ($extension as $key => $value) {
                        $content .= "{$value['name']}:{$value['value']}<BR>";
                      }
                    
                     
                     
    //   $content .= '<QR>http://www.feieyun.com</QR>';//把二维码字符串用标签套上即可自动生成二维码
    
    
      //提示:
      //SN => 打印机编号
      //$content => 打印内容,不能超过5000字节
      //$times => 打印次数,默认为1。
      //打开注释可测试
                $this->printMsg($this->SN,$content,1);//该接口只能是小票机使用,如购买的是标签机请使用下面方法3,调用打印
        }
      /**
       * [批量添加打印机接口 Open_printerAddlist]
       * @param  [string] $printerContent [打印机的sn#key]
       * @return [string]                 [接口返回值]
       */
     public function printerAddlist($printerContent){
        $time = time();         //请求时间
        $msgInfo = array(
          'user'=>$this->USER,
          'stime'=>$time,
          'sig'=>$this->signature($time),
          'apiname'=>'Open_printerAddlist',
          'printerContent'=>$printerContent
        );
        $client = new HttpClient($this->IP,$this->PORT);
        if(!$client->post($this->PATH,$msgInfo)){
          return 'error';
        }else{
          $result = $client->getContent();
          return json_encode($result);
        }
      }
    
    
      /**
       * 打印订单[接口 Open_printMsg]
       * @param  [string] $sn      [打印机编号sn]
       * @param  [string] $content [打印内容]
       * @param  [string] $times   [打印联数]
       * @return [string]          [接口返回值]
       */
      public  function printMsg($sn,$content,$times){
        $time = time();         //请求时间
        $msgInfo = array(
          'user'=>$this->USER,
          'stime'=>$time,
          'sig'=>$this->signature($time),
          'apiname'=>'Open_printMsg',
          'sn'=>$sn,
          'content'=>$content,
          'times'=>$times//打印次数
        );
        $client = new HttpClient($this->IP,$this->PORT);
        if(!$client->post($this->PATH,$msgInfo)){
          return 'error';
        }else{
          //服务器返回的JSON字符串,建议要当做日志记录起来
          $result = $client->getContent();
          return json_encode($result);
        }
      }
    
      /**
       * 标签机打印订单[接口 Open_printLabelMsg]
       * @param  [string] $sn      [打印机编号sn]
       * @param  [string] $content [打印内容]
       * @param  [string] $times   [打印联数]
       * @return [string]          [接口返回值]
       */
     public  function printLabelMsg($sn,$content,$times){
        $time = time();         //请求时间
        $msgInfo = array(
          'user'=>$this->USER,
          'stime'=>$time,
          'sig'=>$this->signature($time),
          'apiname'=>'Open_printLabelMsg',
          'sn'=>$sn,
          'content'=>$content,
          'times'=>$times//打印次数
        );
        $client = new HttpClient($this->IP,$this->PORT);
        if(!$client->post($this->PATH,$msgInfo)){
          return 'error';
        }else{
          //服务器返回的JSON字符串,建议要当做日志记录起来
          $result = $client->getContent();
          return json_encode($result);
        }
      }
    
      /**
       * 批量删除[打印机 Open_printerDelList]
       * @param  [string] $snlist [打印机编号,多台打印机请用减号“-”连接起来]
       * @return [string]         [接口返回值]
       */
      public  function printerDelList($snlist){
        $time = time();         //请求时间
        $msgInfo = array(
          'user'=>$this->USER,
          'stime'=>$time,
          'sig'=>$this->signature($time),
          'apiname'=>'Open_printerDelList',
          'snlist'=>$snlist
        );
        $client = new HttpClient($this->IP,$this->PORT);
        if(!$client->post($this->PATH,$msgInfo)){
          return 'error';
        }else{
          $result = $client->getContent();
          return json_encode($result);
        }
      }
    
      /**
       * 修改打印机信息[接口 Open_printerEdit]
       * @param  [string] $sn       [打印机编号]
       * @param  [string] $name     [打印机备注名称]
       * @param  [string] $phonenum [打印机流量卡号码,可以不传参,但是不能为空字符串]
       * @return [string]           [接口返回值]
       */
      public  function printerEdit($sn,$name,$phonenum){
        $time = time();         //请求时间
        $msgInfo = array(
          'user'=>$this->USER,
          'stime'=>$time,
          'sig'=>$this->signature($time),
          'apiname'=>'Open_printerEdit',
          'sn'=>$sn,
          'name'=>$name,
          'phonenum'=>$phonenum
        );
        $client = new HttpClient($this->IP,$this->PORT);
        if(!$client->post($this->PATH,$msgInfo)){
          return 'error';
        }else{
          $result = $client->getContent();
          return json_encode($result);
        }
      }
    
    
      /**
       * 清空待打印订单[接口 Open_delPrinterSqs]
       * @param  [string] $sn [打印机编号]
       * @return [string]     [接口返回值]
       */
      public  function delPrinterSqs($sn){
        $time = time();         //请求时间
        $msgInfo = array(
          'user'=>$this->USER,
          'stime'=>$time,
          'sig'=>$this->signature($time),
          'apiname'=>'Open_delPrinterSqs',
          'sn'=>$sn
        );
        $client = new HttpClient($this->IP,$this->PORT);
        if(!$client->post($this->PATH,$msgInfo)){
          return 'error';
        }else{
          $result = $client->getContent();
          return json_encode($result);
        }
      }
    
      /**
       * 查询订单是否打印成功[接口 Open_queryOrderState]
       * @param  [string] $orderid [调用打印机接口成功后,服务器返回的JSON中的编号 例如:123456789_20190919163739_95385649]
       * @return [string]          [接口返回值]
       */
      public  function queryOrderState($orderid){
        $time = time();         //请求时间
        $msgInfo = array(
          'user'=>$this->USER,
          'stime'=>$time,
          'sig'=>$this->signature($time),
          'apiname'=>'Open_queryOrderState',
          'orderid'=>$orderid
        );
        $client = new HttpClient($this->IP,$this->PORT);
        if(!$client->post($this->PATH,$msgInfo)){
          return 'error';
        }else{
          $result = $client->getContent();
          return json_encode($result);
        }
      }
    
      /**
       * [查询指定打印机某天的订单统计数接口 Open_queryOrderInfoByDate]
       * @param  [string] $sn   [打印机的编号]
       * @param  [string] $date [查询日期,格式YY-MM-DD,如:2019-09-20]
       * @return [string]       [接口返回值]
       */
      public  function queryOrderInfoByDate($sn,$date){
        $time = time();         //请求时间
        $msgInfo = array(
          'user'=>$this->USER,
          'stime'=>$time,
          'sig'=>$this->signature($time),
          'apiname'=>'Open_queryOrderInfoByDate',
          'sn'=>$sn,
          'date'=>$date
        );
        $client = new HttpClient($this->IP,$this->PORT);
        if(!$client->post($this->PATH,$msgInfo)){
          return 'error';
        }else{
          $result = $client->getContent();
          return json_encode($result);
        }
      }
    
      /**
       * 获取某台打印机状态[接口 Open_queryPrinterStatus]
       * @param  [string] $sn [打印机编号]
       * @return [string]     [接口返回值]
       */
      public  function queryPrinterStatus($sn){
        $time = time();         //请求时间
        $msgInfo = array(
          'user'=>$this->USER,
          'stime'=>$time,
          'sig'=>$this->signature($time),
          'apiname'=>'Open_queryPrinterStatus',
          'sn'=>$sn
        );
        $client = new HttpClient($this->IP,$this->PORT);
        if(!$client->post($this->PATH,$msgInfo)){
          return 'error';
        }else{
          $result = $client->getContent();
          return json_encode($result);
        }
      }
    
      /**
       * [signature 生成签名]
       * @param  [string] $time [当前UNIX时间戳,10位,精确到秒]
       * @return [string]       [接口返回值]
       */
      public  function  signature($time){
        return sha1($this->USER.$this->UKEY.$time);//公共参数,请求公钥
      }
    }
     
     
    
    
     
    
      //****************************************方法3 标签机专用打印订单接口****************************************************
      //***接口返回值说明***
      //正确例子:{"msg":"ok","ret":0,"data":"123456789_20160823165104_1853029628","serverExecutedTime":6}
      //错误例子:{"msg":"错误信息.","ret":非零错误码,"data":null,"serverExecutedTime":5}
    
      //标签说明:
    //   $content = "<DIRECTION>1</DIRECTION>";//设定打印时出纸和打印字体的方向,n 0 或 1,每次设备重启后都会初始化为 0 值设置,1:正向出纸,0:反向出纸,
    //   $content .= "<TEXT x='9' y='10' font='12' w='1' h='2' r='0'>#001       五号桌      1/3</TEXT><TEXT x='80' y='80' font='12' w='2' h='2' r='0'>可乐鸡翅</TEXT><TEXT x='9' y='180' font='12' w='1' h='1' r='0'>张三先生       13800138000</TEXT>";//40mm宽度标签纸打印例子,打开注释调用标签打印接口打印
      
      //提示:
      //SN => 打印机编号
      //$content => 打印内容,不能超过5000字节
      //$times => 打印次数,默认为1。
      //打开注释可测试
      // printLabelMsg(SN,$content,1);//打开注释调用标签机打印接口进行打印,该接口只能是标签机使用,其它型号打印机请勿使用该接口
    
     
    
    
      //************************************方法5 修改打印机信息接口************************************************
      //***接口返回值说明***
      //成功:{"msg":"ok","ret":0,"data":true,"serverExecutedTime":5}
      //错误:{"msg":"参数错误 : 参数值不能传空字符,\"\"、\"null\"、\"undefined\".","ret":-2,"data":null,"serverExecutedTime":1}
      //提示:
      //SN => 打印机编号
      //$name => 打印机备注名称
      //$phonenum => 打印机流量卡号码
      //打开注释可测试
      //$name = "飞鹅云打印机";
      //$phonenum = "01234567891011121314";
      // printerEdit(SN,$name,$phonenum);
    
    
    
      //************************************方法6 清空待打印订单接口************************************************
      //***接口返回值说明***
      //成功:{"msg":"ok","ret":0,"data":true,"serverExecutedTime":4}
      //错误:{"msg":"验证失败 : 打印机编号和用户不匹配.","ret":1002,"data":null,"serverExecutedTime":3}
      //错误:{"msg":"参数错误 : 参数值不能传空字符,\"\"、\"null\"、\"undefined\".","ret":-2,"data":null,"serverExecutedTime":2}
      //提示:
      //SN => 打印机编号
      //打开注释可测试
      // delPrinterSqs(SN);
    
    
      //*********************************方法7 查询订单是否打印成功接口*********************************************
      //***接口返回值说明***
      //正确例子:
      //已打印:{"msg":"ok","ret":0,"data":true,"serverExecutedTime":6}
      //未打印:{"msg":"ok","ret":0,"data":false,"serverExecutedTime":6}
    
      //提示:
      //$orderid => 订单ID,由方法1接口Open_printMsg返回。
      //打开注释可测试
      //$orderid = "123456789_20160823165104_1853029628";//订单ID,从方法1返回值中获取
      //queryOrderState($orderid);
    
    
    
      //*****************************方法8 查询指定打印机某天的订单统计数接口*****************************************
      //***接口返回值说明***
      //正确例子:
      //{"msg":"ok","ret":0,"data":{"print":6,"waiting":1},"serverExecutedTime":9}
      //错误:{"msg":"验证失败 : 打印机编号和用户不匹配.","ret":1002,"data":null,"serverExecutedTime":3}
    
      //提示:
      //$date => 查询日期,格式YY-MM-DD,如:2016-09-20
      //打开注释可测试
      // $date = "2016-09-20";
      // queryOrderInfoByDate(SN,$date);
    
    
    
      //***********************************方法9 获取某台打印机状态接口***********************************************
      //***接口返回值说明***
      //正确例子:
      //{"msg":"ok","ret":0,"data":"离线","serverExecutedTime":9}
      //{"msg":"ok","ret":0,"data":"在线,工作状态正常","serverExecutedTime":9}
      //{"msg":"ok","ret":0,"data":"在线,工作状态不正常","serverExecutedTime":9}
    
      //提示:
      //SN => 填打印机编号
      //打开注释可测试
      // queryPrinterStatus(SN);
    
    
    
    
    ?>
    
    

    3、使用

    use feieyun\Feieyun; 
     
     /*打印*/
        public function index()
        { 
           
            $Feieyun=new Feieyun("921555411");
            $title="测试标题api".time();
            $note="测试备注api".time();
            $goods=[
                ["name"=>"测试商品","price"=>"10.00","num"=>3],
                ["name"=>"测试商品品","price"=>"10.00","num"=>3],
                ["name"=>"测试商品3测试商品2测试商品2","price"=>"10.00","num"=>3],
                ];
            $extension =[
                    ["name"=>"测试","value"=>"10.00" ], 
                    ["name"=>"测试商品1","value"=>"10.00" ], 
                    ["name"=>"时间","value"=>date("Y-m-d") ], 
                ];
            $Feieyun->printReceipts($title,$goods,$note,$extension);
      
        }
    
       //*************************************批量添加打印机接口*************************************************
      //提示:
      //$printerConten => 打印机编号sn(必填) # 打印机识别码key(必填) # 备注名称(选填) # 流量卡号码(选填), 每次最多100台。
         public function add()
        { 
            $printerData=[
                ["Sn"=>"921555411","KEY"=>"amnkatm5","remark"=>"测试","carnum"=>""],
                // ["Sn"=>"921555412","KEY"=>"amnkatm2","remark"=>"测试2","carnum"=>""],
            ];  
            
            $Feieyun=new Feieyun();
            $Feieyun->batchAdd($printerData);
      
        } 
      //************************************* 批量删除打印机接口*************************************************
      //提示:
      //$printerConten => 打印机编号sn(必填) , 每次最多100台 。
     public function del()
        {  
      
            $printerData=[
               921555411,
           
            ];  
            
            $Feieyun=new Feieyun();
            $Feieyun->batchDel($printerData);
      
        }
    
    
    展开全文
  • 因项目需求,需要打印类似超市的...一:获取电脑本地所有的打印服务。 @RequestMapping("/getPrint") @ResponseBody public Object getPrint(){ PrintRequestAttributeSet printRequestAttributeSet = new Has...

    因项目需求,需要打印类似超市的收银小票。

    贴上代码,以供记录和参考。

    一:获取电脑本地所有的打印服务。

    @RequestMapping("/getPrint")
        @ResponseBody
        public Object getPrint(){
            PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
            DocFlavor flavor = DocFlavor.BYTE_ARRAY.PNG;
            PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor,printRequestAttributeSet );
            //获取打印机列表
            List<String> printList = new ArrayList<>();
            for (int i = 0;i<printService.length;i++){
                printList.add(printService[i].getName());
            }
            return new ReportResponse(printList);
        }

    返回结果:

    {
        "header": {
            "code": "200",
            "memo": "success"
        },
        "result": [
            "Microsoft XPS Document Writer",
       
    展开全文
  • 基带分配编号为基带分配的编号标识了查询访问代码和设备/服务类别(CoD)字段。通用和特定于设备的查询访问代码(DIAC)该查询访问码(IAC)是寻找过滤的第一级 的蓝牙® 设备和服务。定义多个IAC的主要目的是限制扫描范围...
  • jQuery调用打印机

    千次阅读 2017-08-04 09:54:48
    学生编号: < label id = "Dcode" > label > li > < li > 姓名: < label id = "Dname" > label > li > < li > 性别: < label id = "Dgender" > label > li > < li > 部门: < label id = ...
  • Android之飞鹅WiFi打印机

    千次阅读 2021-08-11 17:23:00
    Android之飞鹅WiFi打印机说明效果图实现步骤公共参数添加打印机删除打印机打印小票SHA-1加密字符串Bytes数组转换为字符串 说明 因公司需求,需要实现连接WiFi打印机进行打印,很多年还没有WiFi的时候做过蓝牙打印机...
  • 打印机漏洞(rce)

    千次阅读 2021-05-10 21:50:37
    在翻阅论文的时候,突然想起来之前的时候,看到过一些打印机的漏洞;然后就在谷歌上搜索了一下,“printer rce”,然后找到了这篇文章《A Sheep in Wolf’s Clothing – Finding RCE in HP’s Printer Fleet》 说...
  • CUPS学习五:打印机基础

    千次阅读 2018-08-08 17:09:08
    打印机基础 每个打印机队列都拥有相关名称。打印机名必须以字母开头,且可包含127个字母、数字和下划线(_)。由于不区分大小写,所以PRINTER、Printer和printer都相同。 1. 打印机设备 打印机队列拥有相关的设备...
  • 网络打印机端口号.doc

    2021-07-25 07:17:59
    网络打印机端口号网络打印机端口号篇一:更改网络打印机的打印端口号如何在telnet命令下更改IP网络打印机的9100端口状态试验设备:大厅走廊里的laserjet 3330+jetdirect 310X1.打开cmd窗口,输入…连接主机,2.如果...
  • //打印机编号 $content = '123';//打印内容 $data = json_encode(array("user"=>$user,"timestamp"=>$timestamp,"sign"=>$sign,"sn"=>$sn,"content"=>$content)); $url = ...
  • 如何为运行 64 位版本的打印机的计算机查找兼容的打印机Windows09/...适用于: Windows 10 - 所有版本,Windows Server 2012 R2原始 KB 编号: 895612如果您无法从打印机制造商或 Microsoft Windows Update 网站获取...
  • 解决打印机问题如果你无法在 Windows 10 中进行打印或连接到你的打印机,请按照以下步骤来尝试解决该问题:1.请确保打印机已接入电源并打开。请检查(有线打印机的)USB 连接或(无线打印机的)无线连接。有关详细信息,...
  • 在餐饮中,一般采用的都是POS打印机。但是,在很多点菜系统中,丢单是一件很头痛的事情。本文就如何用Java实现绕过驱动控制打印并实现丢单处理,给出一种解决办法。本文面对的需求是,一个单据同时由多个打印机打印...
  • 该课题由独角兽暑期训练营第二届学员张熙宸完成,课题完成后, 等待厂商修复相关漏洞,到现在才发布。360独角兽安全团队每年暑假都会面向在校学生举办一次暑期...前言假期研究了一款智能打印机,后来某厂送来了一...
  • (转)pb控制打印机

    千次阅读 2019-06-19 10:01:44
    在使用连续纸打印数据窗口的情况下,需要定制打印的页长,以保证打印机走纸正确,不用人工干预,实现连续打印。在PB中须调用外部函数来自定义纸张长度,比较繁琐。本文介绍一种直接对打印机的控制方法...
  • js调用打印机

    2017-06-25 22:20:00
    编号: " text " name= " sturegcard " class = " input1 ml10 " value= " <!--{$aListData.sturegcard}--> " /> 头像: " <!--{$aListData.avatar}--> " width= " 140 " > 考试日程: ...
  • java连接打印机

    千次阅读 2019-07-11 20:26:33
    佳博打印机 在佳博官网下载驱动包,要和自己的机型匹配。我使用的是GP-3120TU打印机,驱动包如下: 点击安装,选择GP-3120TU 设置打印机端口 使用连接线选择usb端口,完成后可以打印空白页进行测试。刚开始...
  • 获取设备唯一标识的例子
  • 一、蓝牙打印机连接 1.蓝牙权限 2.初始化配置 3.发现设备 4.连接设备 5.数据传输 二、WIFI打印机连接 一、蓝牙打印机连接 打印机的蓝牙连接方式是基于传统的蓝牙连接方式,手机作为客户端,打印机作为服务端...
  • Android接入热敏打印机

    2020-11-14 10:33:15
    首先是解析类 PrintUser public class PrintUser implements Serializable { /** * pharmacy : 药房 ... * agentCode : 终端编号 * purchaseType : 购药类型 * drug : [{"productName":"品名",
  • 1.进设备管理器查看无线网卡驱动是否正常安装。路径:右键单击我的电脑...这类计算机的工作模式十分直观:在一个时钟周期内,计算机先从存储器中获取指令和数据,然后执行指令,存储数据,再获取下一条指令。 取消 评论
  • 尝试使用别名 CNAME 或资源记录 (连接到打印机时) 错误消息:Windows无法连接到打印机10/15/2020本文内容本文提供了一个解决方案,用于解决尝试使用 CNAME 或资源记录中的别名 (连接到打印机) 的错误。适用于: ...
  • 最近学习过程中,想到提取系统硬件信息做一些验证,故而对网上提到的利用.NET System.Management类获取硬件信息做了进一步的学习、验证。验证是分别在4台电脑,XP SP3系统中进行,特将验证过程...获取CPU编号: <a onc
  • uniapp蓝牙连接热敏打印机

    千次阅读 2021-03-11 14:22:08
    uniapp蓝牙连接热敏打印机 需求:通过小程序连接蓝牙,打印指定内容 前提:根据打印机的品牌型号不同,所遵循的打印规范不同(具体询问卖家) 我使用的是佳博的tspl规范
  • 目标任务: 用两台打印机分别实现打印不容的小票 1. 实体类:商品信息 /** * 商品信息类 * @author admin * */ public class Commodity { // 商品名称 private String name; // 商品单价 private ...
  • 使用组策略设置控制 Active Directory 中的打印机09/08/...适用于: Windows Server 2012R2原始 KB 编号: 234270摘要可以使用组策略设置启用或禁用 Active Directory 打印机相关设置。 所有组策略设置都包含在组...
  • win32打印机控制,API打印操作

    千次阅读 2014-08-10 19:01:18
    printf("获取打印机设置时发生了错误.\n"); return 0; } devMode->dmPaperSize = DMPAPER_A4; //打印机纸张设置为A4。 devMode->dmOrientation = DMORIENT_PORTRAIT; //打印方向设置成纵向打印 //...
  • java实现打印机打印

    千次阅读 2020-10-10 10:48:14
    } private void render(HttpServletResponse response, String result){ //设置为text/html,返回的是json字符串,设置为application/json,获取的是对象 response.setContentType("text/html; utf-8"); // ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 8,870
精华内容 3,548
关键字:

如何获取打印机编号