开发者

PHP (local wamp) - how to print without print dialogue

开发者 https://www.devze.com 2023-02-18 17:48 出处:网络
Trying to find a good way to print without the print dialogue on my LOCAL wamp in开发者_JAVA百科stallation, in other words the printer is connected to the server.

Trying to find a good way to print without the print dialogue on my LOCAL wamp in开发者_JAVA百科stallation, in other words the printer is connected to the server.

The best (theoretical) way I have found so far seems to be using PHP's exec function, by either running a .bat that will use notepad to open and print the file or by running notepad and printing form there.

EG:

<?php
$exe_tmp = exec('E:\WebServer\www\testprint.bat');

//or

$exe_tmp = exec('c:\WINDOWS\system32\cmd.exe /c "E:\WebServer\www\MOSys\ePos\testprint.bat"');
?>

testprint.bat

NOTEPAD /P E:\WebServer\www\current_reciept.txt

Running either of these form cmd.exe works perfectly but when trying to run it using PHP's exec, when $exe_tmp is echoed, I get seemingly nothing and an output of:

E:\WebServer\www>NOTEPAD /P E:\WebServer\www\current_reciept.txt

If anyone knows why the above don't work when called from exec(); that would be very good, or if anyone knows of another way to bypass the print dialogue that would be excellent.

Cheers Charlie


I think the answer lies here:http://technet.microsoft.com/en-us/library/cc772773(WS.10).aspx

It would result in something like this:

$exe_tmp = exec('c:\WINDOWS\system32\cmd.exe /c "print /d:\\SERVER\printer e:\WebServer\www\current_reciept.txt"');

I din't test it but according to the microsoft site it sends it directly to the queue

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号