Reputation: 11
I creating a program to take print of document using php.
$printer = printer_open("HP Deskjet 3050 J610 series");
printer_start_doc($printer, "Doc");
printer_start_page($printer);
$barcode = printer_create_font("Free 3 of 9 Extended", 400, 200, PRINTER_FW_NORMAL, false, false, false, 0);
$arial = printer_create_font("Arial", 148, 76, PRINTER_FW_MEDIUM, false, false, false, 0);
printer_select_font($printer, $barcode);
printer_draw_text($printer, "*123456*", 50, 50);
printer_select_font($printer, $arial);
printer_draw_text($printer, "123456", 250, 500);
printer_delete_font($barcode);
printer_delete_font($arial);
printer_end_page($printer);
printer_end_doc($printer);
printer_close($printer);
I used the above code,But it only give print of lines. How to take print of a document using program ?
Upvotes: 1
Views: 6238
Reputation: 1034
adding to @varu.. answer use javascript window.open.If in a form use as below
<form><input type="button" value="Print my page" onClick="window.print()"></form>
It works the same as using CTRL + P with browser open.
Upvotes: 0
Reputation: 464
set your default printer to "HP Deskjet 3050 J610 series" and make online. And call to php code without setting any parameter printer_open();
(if not specified in php.ini as printer.default_printer, PHP tries to detect it)
thanks.
Upvotes: 1