Board index » delphi » How to determine printer information at runtime?
M.Sameer
Delphi Developer |
M.Sameer
Delphi Developer |
How to determine printer information at runtime?2003-12-10 06:33:19 PM delphi130 Hi All, I want to get some information about the printer seetings at runtime like: (1) Printer supported fonts and how can I set them? (2) Printer supported code pages and how can I select one? (3) Printer CPI and how can I set it? (4) I am using a dot matrix printer and I want to know if the commands sent to the printer in RAW printing mode is printer dependent or is it standard to some extent? Thanks in advance, M.Sameer |
Mike Shkolnik
Delphi Developer |
2003-12-10 09:15:57 PM
Re:How to determine printer information at runtime?Quote(1) Printer supported fonts and how can I set them? Quote(2) Printer supported code pages and how can I select one? Quote(3) Printer CPI and how can I set it? Quote(4) I am using a dot matrix printer and I want to know if the commands sent |
Toni Martir
Delphi Developer |
2003-12-12 07:26:11 AM
Re:How to determine printer information at runtime?
There are two options:
1- You can send text in raw mode so the driver send it as you provide, without changes. So you must provide escape codes to initialize printer, select font, end page etc.. This escapes are diferent for many dot matrix printers but there are three escape code sets that are the most used (IBM Proprinter compatible, Epson Compatible and Epson TM -receipt printer compatible). But you can not print graphics or drawings unless you code them manually into escape codes, really hard work. Code page depends on printer model, usually a western europen code page is selected by default. Before sending any text you should translate to the OEM charset (CharToOem) 2- Let the windows driver do the (hard)work, but you must select the font by name, you can enumerate them using EnumFontFamilies, you can view the printer fonts in Wordpad for example. But Font Names are diferent for different print drivers. This requires good driver quality to handle paper sizes etc... This method also allows you to print graphics and drawings, that is any operation supported by the driver (see GetDeviceCaps). The charset is automatically handled by the printer driver. Report Manager solves both problems for you: Case 1: Send plain text with escape codes to the printer reportman.sourceforge.net/doc/dotmatrix.html Case 2: Use device fonts reportman.sourceforge.net/doc/pagesetup.html, it search for the most suitable printer font, your report works in any printer. Quote(1) Printer supported fonts and how can I set them? |