Background
Recently, our company received a project, to help scenic sell tickets. I have to develop ticket print function.
Progress
Any Problem?
Our client have an existing system, they do this using preview, and call system print by browser.
WTF
Our client make a decision, when they click “print” button, there is no preview and other, just print it directly, and, we have to make it as a B/S arch. Therefore, I can only use IE to call dll.
At this moment, our leader tell me: there’s no problem, this framework support IE perfectly.
WTF x2
Yep, just like your think, it’s hardly to find a modern framework that support IE. I can just change my Implementation, run a server on local machine, there have some algorithm to calculate height, it’s annoying to rewrite, so I use a shortcut : all calculation use js on browser but just output printer commands, then local server can forward it to printer.
Problem Raised
It looks like the printer dll provided method have decode Unicode Character as GBK, so we have to convert the coding before send it to printer.
Solution
iconv, a library to convert between codings, this time we convert ‘UTF-8’ to ‘GBK’.