I'm looking to achieve some kind of a template for invoice through php_printer to be sent auto to the printer. After hours i managed to get the thing going + solved the encoding issue (i need Greek) but i don't seem to understand why would printer_write
work and printer_draw_text
isn't.
I need to be able to draw new lines and asign some left and right but printer_write
seems to be overwriting everything that is already in the document.
One thing to notice is the fact that if i add a
printer_start_doc($handle, "My Document");
printer_start_page($handle);
printer_end_page($handle);
printer_end_doc($handle);
Everything on the file is messed up with the PRINTER info being on top and then below are nonesense.
Below is the code i'm running
$handle = printer_open("Emulator");
printer_set_option($handle, PRINTER_MODE, "raw");
$font = printer_create_font("@Batang", 148, 76, PRINTER_FW_MEDIUM, false, false, false, -50);
printer_select_font($handle, $font);
$sql = mysql_query("...")or die(mysql_error());
while($row = mysql_fetch_array($sql))
{
$lineofText = 'x'.$row['salelines_units'].' '.getProductName($row['salelines_product']).' $ '.$row['salelines_price'];
printer_draw_text($handle, $lineofText, 10, 10);
}
//printer_write($handle,$print);
printer_close($handle);
This won't send anything to the printer. If i remove the printer_write
from comments it prints the $print
variable.
EDIT: Even if i use start_doc and start_page
and print nothing i still get all the printer info and document info at the top but then all symbols and something 320W