使用 PHP 打印到外部收据打印机

发布于 2024-10-14 22:47:45 字数 442 浏览 9 评论 0原文

我正在尝试找到一种将实时订单发送到收据打印机的解决方案。

基本上是伪代码:

if ($order == 'success')
{
    $printer = ip.to.remove.printer;

    $receipt_text = 'You just received an order!';

    $ch = curl_init('http://addresstosomekindofapi.com/print_receipt/');
    curl_setopt($ch, SOME_OPTION, 0).............;

    curl_exec($ch);
    curl_close($ch);
}

我只是在探索完成此任务的选项。如果能够做到这一点,而不是发送经常需要线路占用的传真,那真是太棒了。

如何才能实现这一目标呢?

I'm trying to find a solution for sending live orders to a receipt printer.

Basically in pseudo-code:

if ($order == 'success')
{
    $printer = ip.to.remove.printer;

    $receipt_text = 'You just received an order!';

    $ch = curl_init('http://addresstosomekindofapi.com/print_receipt/');
    curl_setopt($ch, SOME_OPTION, 0).............;

    curl_exec($ch);
    curl_close($ch);
}

I'm just exploring options in getting this done. It would be awesome to be able to do this rather than send faxes which often have tied up lines, etc, etc.

How could one achieve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦亿 2024-10-21 22:47:45

对我来说,一个可靠的解决方案是构建一个连接到 Web 应用程序并能够将作业发送到打印机的桌面应用程序。我认为 Web 应用程序无法拥有太多控制权来处理用户的打印作业。

To me, a solid solution is to build a desktop application that is connected to your web application and has the ability to send jobs to the printer. I don't think a web application can have much of control as to handle user's print jobs.

鯉魚旗 2024-10-21 22:47:45

有一些打印机(我猜像你的基本办公室惠普激光打印机)可以

  • 通过 ftp 访问
  • ,具有用于纸张选择的“虚拟打印机”模式。

如果我是你,我会调查一下。

(这是假设打印机和 php 文件之间存在某种网络隔离。)

There are printers (like your basic office hp laserjets I guess) that can

  • Be reached trough ftp
  • Have 'virtual printer' modes for paper selection.

I'd look into that if I were you.

(this was assuming there is some sort of network separation between the printer and the php file.)

盛夏已如深秋| 2024-10-21 22:47:45

我认为解决您的问题的最佳解决方案是使用用于打印到 pdf 的 php 类将文档打印到 pdf。这样的班级还有不少。一个很好的类是 ezpdf 类,可以从 http://www.ros 下载.co.nz/pdfhttp://www.sourceforge.net/projects/ pdf-php

I think that the best solution to your problem is printing the document to pdf using a php class for printing to pdf. There are quite a few of such classes. A good one is ezpdf class which can be downloaded from http://www.ros.co.nz/pdf or http://www.sourceforge.net/projects/pdf-php

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文