dtd14883 2014-04-11 07:37
浏览 55

PHP打印机,printer_write工作,printer_draw_text不是

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
    • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
    • ¥100 监控抖音用户作品更新可以微信公众号提醒
    • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
    • ¥70 2048小游戏毕设项目
    • ¥20 mysql架构,按照姓名分表
    • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
    • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题