开发者

printing from apache/php

i have a java based desktop app that i am hoping to rewrite as a php web 开发者_Go百科app.

In the desktop application there is a publish button, that prints multiple copies of the race results to several printers at once, eg results tent, admin, announcers, etc

Server is a windows machine running xampp All printers are network printers and are available directly from server

My initial thoughts are to generate a pdf file and print that via shell exec call, but i am not sure how to control which printer it goes too, and how many copies will come out.

Has anyone tried doing this before, i want to make sure it is all possible before i start


in my opinion its posible like this code


require('./fpdf.php');

$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output('c:\test1.pdf');
shell_exec("'C:\Program Files\Adobe\Acrobat 6.0\Reader\acrord32.exe' /t c:\test1.pdf \\myserver\myprinter");
?>


you can use the printer extension in windows like this

at first do this

Windows users must enable php_printer.dll inside of php.ini

then


$handle = printer_open();
printer_start_doc($handle, "My Document");
printer_start_page($handle);

printer_end_page($handle);
printer_end_doc($handle);
printer_close($handle);
?>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜