Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending data to certain printer

Status
Not open for further replies.

tweetie777

Programmer
Nov 22, 2001
14
0
0
ZA
hi there

i have 3 printers and i want my program only to send information to a certain printer. how do i do this. if any1 can help me i would very grateful. please provide source code example
 
I think something like this would work.

For i := 0 to Printer.Printers.Count -1 do
begin
If Printer.Printers = 'WhateverPrinterName' then
begin
Printer.PrinterIndex := i;
break;
end;
end;
 
I've used this in the past...

Printer.PrinterIndex := Printer.Printers.IndexOf('PrinterName');

Hope it helps. -Jonathan
 
thanks guys, that does help. I do have another problem though. Although, I can get the above code to work when i am writing to the print canvas, it doesnt work when i try printing ms word documents. It still prints to the default printer. A source code sample would be great if you could help me. Thanks a million. My non-working code is as follows

var
msword:eek:levariant;

procedure
begin
msword.fileopen('filename');

Printer.PrinterIndex := Printer.Printers.IndexOf('PrinterName');
msword.fileprint;

end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top