PHP 5 中的服务器端打印 [英] Server side printing in PHP 5

查看:63
本文介绍了PHP 5 中的服务器端打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过 php 脚本打印我的 html 文件?我只想在没有任何提示的情况下在后台运行它.我已经阅读了关于此的其他帖子,但仍然没有找到任何工作.我试过这个:

How can i print my html file via php script? I just want to run it in background without any prompt. I have read other posts regarding this but still didnt find anything working. I tried this one :

<?php
$dir = "temp"; // the folder that you are storing the file to be printed
$file = "file.html"; //change to proper file name
$file_dir = $dir.$file;
$server = "home_computer"; //name of the computer you are printing to on your network
$printer = "HP"; //printers shared name
$command = "print $file_dir /d:\\$server\\$printer";
exec($command) or die("File failed to print");
?>

这里有这个例子 http://www.phpfreaks.com/论坛/index.php/topic,207946.0.html

推荐答案

这是我的工作:

$html = "testing print";
$handle = printer_open();
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, $html);
printer_close($handle);

我们需要 php_printer.dll php 扩展名才能在 php5 中完成这项工作.:)

We require php_printer.dll php extension to make this work in php5. :)

这篇关于PHP 5 中的服务器端打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆