0
I am facing a very strange problem in thermal printer printing using php.
It’s all right, but when the text is big, it doesn’t print everything, it has a standard print size. I couldn’t find anything about it. Follows my code
function imprimir($texto){
$handle = printer_open("Daruma DR800");
printer_set_option($handle, PRINTER_MODE, "RAW",PRINTER_FORMAT_CUSTOM);
printer_start_doc($handle, "Print"); // Name Document
printer_start_page($handle);
$font = printer_create_font("Arial",40,16,PRINTER_FW_NORMAL,false,false,false,0);
printer_select_font($handle, $font);
$posicao = 10;
for($i = 0; $i < count($texto); $i++){
printer_draw_text($handle, $texto[$i], 10, $posicao);
$posicao = $posicao + 40;
}
printer_delete_font($font);
printer_end_page($handle);
printer_end_doc($handle);
printer_close($handle);
}
The variable $texto
is an array of strings.
Note: I know php is not the best option for local printing, but it is the one I need to use in the project.
Thank you very much. It makes sense yes. I am not at home, I will test later and I speak if solved. But thank you for your reply.
– Denis Dias
@Denisdias adjusted the code in a way that will be enough for you to adjust in the variable
$linhasPorPagina
line limit per page.– Guilherme Nascimento
Thank you very much. I’m afraid only printer print when I close the page. But after 6:00 PM I will test.
– Denis Dias
@Denisdias glad you warned me, although it’s a different situation now that I realized that the script could generate an empty page at the end, so I changed the order of the
IF
, I just came by to say.– Guilherme Nascimento
It worked. Thank you very much
– Denis Dias