Quote
coba...@aol.com (COBALOU) wrote:
>i would like to send caracters to my parallel port
> or my serial port to print on my old printer
>(needle printer (sorry for my bad language))
>since if i use printer adminstrator of windows,
> i wait 1 hour because of the graphic mode.
I just finished fighting though exactly the same problem, and here's
what is happening. Windows always wants to print with the default
system font. First Windows checks the installed printer driver to see
if the printer can print the font directly (i.e. is it a printer
font). If it can then Windows sends the document directly to the
printer, if it can't then Windows prepares the document as a graphic
image and sends it to the printer that way. For those people with
ink-jet or laser printers this usually isn't a problem since they will
print graphics just as fast as they'll print text (it's all graphics
to them).
However, for us people with dot matrix printers the story is somewhat
different. For me, printing from Windows can be measured in
minutes/page (and it's usually alot of them). The trick is to make
sure that you tell the Windows (via the Delphi Printer object) that
you want to use one of the fonts supported by your printer.
If you need a quick way to check out what fonts are available drop a
TListBox on a form and add the following line to the OnCreate event
ListBox1.Items := Printer.Fonts;
Take note, that Windows will think all fonts can be printed, so all
the Windows fonts will also be listed, however you can usually spot
which ones are printer fonts (on my Panasonic KX-P1180 the font size
is hardcoded into the font name).
Here is a complete example to show what I mean, and I'll use a
slightly different method to get to the printer than the other replies
I've seen. ;-)
var
PrinterF: TextFile;
begin
Printer.Canvas.Font.Name := 'Draft 12cpi';
AssignPrn(PrinterF);
ReWrite(PrinterF);
Writeln(PrinterF, 'Hello world.');
CloseFile(PrinterF);
end;
Hope this helps.
Keith