utf-8 printing

trx

Member
I see a lot of misunderstanding what printer does. Printer is specialized interpreter controlling some hardware that takes some kind of program and use printing mechanism to create printout. When you click "Print" in notepad 2 things occurs: 1st notepad calls some windows functions to create virtual printout, 2nd windows uses printer driver to convert that printout into program which can be understood by printer's controller. When you "print" file using COPY, OUTPUT TO then you are at 2nd stage - you communicate with printer controller and you are expected to send proper "program" to it but instead of this you simply send file to it. Whether it causes printer to print or not, or whether printout is correct or not it all depends on printer controller - if it is able to correctly interpret such data.
To print the file you need to pass proper "program" to the printer - i.e. you need to talk to printer controller the way it can be understood by printer.
There are 2 methods to achieve this:
- 1st: use printer driver to print the file - as you use MS Win then google for winapi printing to get basic idea how to do that (this way notepad prints) or you can use higher level API like qt - google for qt printing
- 2nd: send to printer properly formatted data - so first of all check what emulations offers you printer - i.e. PCL6, PCL5e, Postscript, ESP/P, etc. and then google for it and convert your file into desired format

Anyway, in this thread you demonstrated you were able to communicate with printer and that you sent data to printer in wrong format.
Some printers are able to understand and print simple text files which are sent directly to printer, some (especially GDI printers) need additional processing. Some printers that allows printing simple text files, have default settings for such printing(like font name, font size, font encoding).
If you want to do additional formatting then you need to talk to printer using proper syntax / formatting / control sequences.
 
Top