简体   繁体   中英

PHP printer not printing on a new line

I'm attaching a 80 mm thermal printer to my windows server, it's working great but when the text is longer than the page width the rest of the text disappears instead of moving it to the next line automatically. here's my code

$handle = printer_open("POS"); 
printer_set_option($handle, PRINTER_PAPER_FORMAT, PRINTER_FORMAT_CUSTOM);
printer_set_option($handle, PRINTER_PAPER_WIDTH, "80");
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_start_doc($handle, "My Document");
printer_start_page($handle);
$font = printer_create_font("Arial", 40, 30, 400, false, false, false, 0);
printer_select_font($handle, $font);
printer_draw_text($handle, $lipsum, 10, 10);
printer_delete_font($font);
printer_end_page($handle);
printer_end_doc($handle);
printer_close($handle);
try this: 

$handle = printer_open("POS"); 
printer_set_option($handle, PRINTER_PAPER_FORMAT, PRINTER_FORMAT_CUSTOM);
printer_set_option($handle, PRINTER_PAPER_WIDTH, "80");
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_start_doc($handle, "My Document");
printer_start_page($handle);
$font = printer_create_font("Arial", 40, 30, 400, false, false, false, 0);
printer_select_font($handle, $font);



printer_draw_text($handle, 'TEST 1', 10, 10);
printer_draw_text($handle, 'TEST 2', 10, 40);
printer_draw_text($handle, 'TEST 3', 10, 70);



printer_delete_font($font);
printer_end_page($handle);
printer_end_doc($handle);
printer_close($handle);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM