Python win32print module
printMethod = 'RAW'
printer = win32print.OpenPrinter(self._printerName)
win32print.StartDocPrinter(printer, 1, ('Automated printjob', None, 'RAW'))
receipt = receipt.encode('big5')
win32print.StartPagePrinter(printer)
win32print.WritePrinter(printer, receipt)
win32print.WritePrinter(printer, self._cmd.fullCut)
win32print.EndPagePrinter(printer)
win32print.EndDocPrinter(printer)
win32print.ClosePrinter(printer)
This is my logic to send a string receipt to the printer. I've attempted to encode the string via utf-8, gb18030, and big5 but all of them prints out random characters instead of the chinese character in the string.
I am using Fujitsu FP2000 printer. Their documentation states that both gb18030 and big5 are supported.
All insights are welcome, thanks.
Writing utf-8 encoded string to a .txt
files results in the correct chinese character output. However, gb18030 and big5 outputs weird characters.
Printing with big5/gb18030 results in the same output, kind of looks like korean characters stretched vertically. Printing with utf-8 results in 'mutated' alphabets(AE combined together, o with a tail etc. hopefully you can understand what I am referring to here)
According to the printer docs, it supports both gb18030 and big5. I've also successfully printed chinese characters from the notepad so i know that the printer supports printing of chinese characters
My issue was in the printer configuration. I had to manually change the expected encoding format.
gb18030-2000
encoding (simplified chinese character compatible)