bumperbox
bumperbox

Reputation: 10214

printing from apache/php

i have a java based desktop app that i am hoping to rewrite as a php web 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

Upvotes: 1

Views: 2334

Answers (2)

AmirModiri
AmirModiri

Reputation: 775

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);
?>

Upvotes: 1

AmirModiri
AmirModiri

Reputation: 775

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");
?>

Upvotes: 1

Related Questions