douzheyo2617 2013-11-26 23:03
浏览 209

从互联网上的php打印到远程打印机

I have a webshop (on a webserver) where customers can order things, somewhere else (at the customers company) I have a printer which needs to instantly print an packing slip whenever the website receives an order.

  1. I have read things about VPN but that's too difficult to set up;
  2. Some people say it's best to let the website send an e-mail and use software to fetch the pop box and print all incoming e-mail
  3. I could use an IP (xml) printer
  4. Now testing with Google Cloud Print Beta
  5. HP has the Eprinting - sending documents to a specific e-mailaddress function
  6. Via HTML / Javascript -> Chrome in kiosk printing mode and a javascript print function (or something with jquery) which every 3 minutes polls database…

I’m totally free in what to use and how to connect the printer (preferably directly on router or on Windows PC).

Numerous of options but I’m not sure which one is most reliable (given the fact that the order needs to be printed instantly)… Also, the printer / API / software needs to be able to give alert feedback when the printer is offline so a SMS or something can be sent.

I know all about PHP, so using any form of API isn't a problem.

  • 写回答

1条回答 默认 最新

  • dongxiao9583 2014-06-03 16:33
    关注
    $content = "Firts Line
    ";
    $content .= "Second Line";
    $content .= char(27).char(ord("E")); // ESC E (command ESC for thermal printers)
    $content .= "Line with effect ESC";
    $f = @fsockopen($print_ip,$print_port,$errno,$errstr); 
    if (!$f) {
        echo "Erro: $errstr<br/>";
        if ($errstr=='No route to host') { die("Verify conncetion."); }
    }
    else {
        if(fwrite($f, $content)) { echo 'success.'; }
        @fclose($f);
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作