<tfoot id='JJKcv'></tfoot>
      <bdo id='JJKcv'></bdo><ul id='JJKcv'></ul>
  • <legend id='JJKcv'><style id='JJKcv'><dir id='JJKcv'><q id='JJKcv'></q></dir></style></legend>

  • <small id='JJKcv'></small><noframes id='JJKcv'>

    <i id='JJKcv'><tr id='JJKcv'><dt id='JJKcv'><q id='JJKcv'><span id='JJKcv'><b id='JJKcv'><form id='JJKcv'><ins id='JJKcv'></ins><ul id='JJKcv'></ul><sub id='JJKcv'></sub></form><legend id='JJKcv'></legend><bdo id='JJKcv'><pre id='JJKcv'><center id='JJKcv'></center></pre></bdo></b><th id='JJKcv'></th></span></q></dt></tr></i><div id='JJKcv'><tfoot id='JJKcv'></tfoot><dl id='JJKcv'><fieldset id='JJKcv'></fieldset></dl></div>

      1. 使用 PHP 将数据打印到打印机

        时间:2023-10-04

        <small id='BtfLt'></small><noframes id='BtfLt'>

            • <bdo id='BtfLt'></bdo><ul id='BtfLt'></ul>
              <i id='BtfLt'><tr id='BtfLt'><dt id='BtfLt'><q id='BtfLt'><span id='BtfLt'><b id='BtfLt'><form id='BtfLt'><ins id='BtfLt'></ins><ul id='BtfLt'></ul><sub id='BtfLt'></sub></form><legend id='BtfLt'></legend><bdo id='BtfLt'><pre id='BtfLt'><center id='BtfLt'></center></pre></bdo></b><th id='BtfLt'></th></span></q></dt></tr></i><div id='BtfLt'><tfoot id='BtfLt'></tfoot><dl id='BtfLt'><fieldset id='BtfLt'></fieldset></dl></div>
                <tbody id='BtfLt'></tbody>

            • <tfoot id='BtfLt'></tfoot>
              <legend id='BtfLt'><style id='BtfLt'><dir id='BtfLt'><q id='BtfLt'></q></dir></style></legend>
                • 本文介绍了使用 PHP 将数据打印到打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个问题困扰了我至少 3 周.我需要使用 php 将一些数据打印到打印机.我将数据保存到 $print_output 变量中,我知道我的数据很好,因为当我通过电子邮件发送它时,它显示了应该显示的所有内容.

                  I have a question that has been troubling me for at least 3 weeks now. I need to print some data to a printer using php. I have data saved into a $print_output variable, and I know my data is good because when I send it via email, it shows everything that is supposed to be shown.

                  好吧,我试着写了这段代码,我以为我可以测试它,但不确定它是否会起作用.

                  Well, I tried writing this code, where I thought I could test it but wasn't sure if it would have even worked.

                  $handle = printer_open("\\192.168.1.33_4\Printer_Office");
                  printer_set_option($handle, PRINTER_MODE, "raw"); 
                  printer_write($handle,$print_output); 
                  printer_close($handle); 
                  

                  好吧,结果我没有安装 php_printer.dll 扩展,我被告知不要重新编译 php 来添加它.

                  Well, turns out I don't have php_printer.dll extension installed and I was told not to re-compile php to add it.

                  我想要做的只是将存储在 $print_output 中的数据打印到同一网络上的打印机.我不想使用 javascript 函数 window.print() 因为我无法弹出打印对话屏幕.

                  What I'd like to do is simply print out the data that is stored in $print_output to a printer on my same network. I don't want to use the javascript function window.print() because I can't have a print dialogue screen pop up.

                  有没有人有任何信息可以为我指明正确的方向?或者另一种直接将少量数据打印到打印机而不使用 php 的 printer_open 函数的方法?

                  Does anyone have any information that can point me in the right direction? Or another way to simply print a small amount of data directly to the printer without using php's printer_open function?

                  推荐答案

                  对于遇到同样问题的任何人,我发现我可以简单地使用套接字编程推送数据,如下所示.下面的ip地址是我打印机的ip地址.如果您愿意,您可以通过 telnet 连接到您的打印机,以确保连接能够正常工作.

                  For anyone who is having the same trouble, I figured out I can simply push the data using socket programming as follows. The ip address below is my printer's ip address. You can telnet into your printer to make sure the connection works beforehand if you'd like.

                  if(isset($_POST['order'])){
                  $print_output= $_POST['order'];
                  }
                  try
                  {
                      $fp=pfsockopen("192.168.1.33", 9100);
                      fputs($fp, $print_output);
                      fclose($fp);
                  
                      echo 'Successfully Printed';
                  }
                  catch (Exception $e) 
                  {
                      echo 'Caught exception: ',  $e->getMessage(), "
                  ";
                  }
                  

                  这篇关于使用 PHP 将数据打印到打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:POS:让网站直接打印到定义的本地打印机 下一篇:wkhtmltopdf:哪些纸张尺寸有效?

                  相关文章

                  最新文章

                • <legend id='LxiXi'><style id='LxiXi'><dir id='LxiXi'><q id='LxiXi'></q></dir></style></legend>

                • <i id='LxiXi'><tr id='LxiXi'><dt id='LxiXi'><q id='LxiXi'><span id='LxiXi'><b id='LxiXi'><form id='LxiXi'><ins id='LxiXi'></ins><ul id='LxiXi'></ul><sub id='LxiXi'></sub></form><legend id='LxiXi'></legend><bdo id='LxiXi'><pre id='LxiXi'><center id='LxiXi'></center></pre></bdo></b><th id='LxiXi'></th></span></q></dt></tr></i><div id='LxiXi'><tfoot id='LxiXi'></tfoot><dl id='LxiXi'><fieldset id='LxiXi'></fieldset></dl></div>
                    <bdo id='LxiXi'></bdo><ul id='LxiXi'></ul>
                • <tfoot id='LxiXi'></tfoot>
                  1. <small id='LxiXi'></small><noframes id='LxiXi'>