jiraiya21 Posted September 6, 2012 Share Posted September 6, 2012 I have already asked help from google but with no solution. So i am resorting to asking help from you guys. I have no problem printing regular ASCII characters on a network printer, i am just really having problem printing Chinese, Japanese, Arabic, UTF-8 characters. i almost tried everything i could find on google even playing with the mbstring settings. Below is the code i use to test my server printing. $sText = '測試 test'; <-- Aw! This site does not support utf-8, preview post shows what i see on my printout, hahaha, please try using translate.google for the testing if you can. Still, thank you phpfreaks.com for letting me ask for help. $rHandle = printer_open('BGP02'); $rFont = printer_create_font('Consolas', 20, 10, 100, false, false, false, 0); printer_set_option($rHandle, PRINTER_MODE, 'TEXT'); printer_start_doc($rHandle, "My Queue"); printer_start_page($rHandle); printer_select_font($rHandle, $rFont); printer_draw_text($rHandle, $sText, 0, 0); printer_delete_font($rFont); printer_end_page($rHandle); printer_end_doc($rHandle); printer_close($rHandle); Quote Link to comment https://forums.phpfreaks.com/topic/268052-php_printerdll-problem-with-utf-8-or-other-chars-like-chinese-japanese/ Share on other sites More sharing options...
Christian F. Posted September 6, 2012 Share Posted September 6, 2012 There are a few things I can think of that might be the cause of the issue: The font you've selected is not UTF-8 compatible. The TEXT mode might support only ASCII characters, which means you'll probably have to use one of the other options. There's also a note on the manual page for printer_set_option () about a bug. It's from 2009, so not sure if it's still valid. You might have to use postscript to communicate with the server. Most likely this will require "RAW" instead of "TEXT" PS: Please use the tags around your code, as it helps make both your post and your code a lot easier to read. Quote Link to comment https://forums.phpfreaks.com/topic/268052-php_printerdll-problem-with-utf-8-or-other-chars-like-chinese-japanese/#findComment-1375869 Share on other sites More sharing options...
jiraiya21 Posted September 11, 2012 Author Share Posted September 11, 2012 Hi Christian, Thanks for the suggestions but i am still having the same problem. I tried a font face i got from another site. I am on the verge of banging my head. Anybody who got a solution for this, i really need help. Cheers! <?php $sText = '測試 test'; $rHandle = printer_open('BGP02'); $rFont = printer_create_font('新細明體', 20, 10, 100, false, false, false, 0); printer_set_option($rHandle, PRINTER_MODE, 'RAW'); printer_start_doc($rHandle, "My Queue"); printer_start_page($rHandle); printer_select_font($rHandle, $rFont); printer_draw_text($rHandle, $sText, 0, 0); printer_delete_font($rFont); printer_end_page($rHandle); printer_end_doc($rHandle); printer_close($rHandle); ?> Quote Link to comment https://forums.phpfreaks.com/topic/268052-php_printerdll-problem-with-utf-8-or-other-chars-like-chinese-japanese/#findComment-1376935 Share on other sites More sharing options...
jiraiya21 Posted September 11, 2012 Author Share Posted September 11, 2012 This site automatically parse my code please replace two of the lines with the two below $sText = '測試 test'; $rFont = printer_create_font('新細明體', 20, 10, 100, false, false, false, 0); Quote Link to comment https://forums.phpfreaks.com/topic/268052-php_printerdll-problem-with-utf-8-or-other-chars-like-chinese-japanese/#findComment-1376953 Share on other sites More sharing options...
Christian F. Posted September 11, 2012 Share Posted September 11, 2012 Have you verified that the $rFont result is a resource, and not false? Also, tried my last suggestion from my previous post? You might need to ask the company that made the printer, they should be more familiar with its capabilities after all. Quote Link to comment https://forums.phpfreaks.com/topic/268052-php_printerdll-problem-with-utf-8-or-other-chars-like-chinese-japanese/#findComment-1376955 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.