Compila esto lo acabo de probar y funciona sin problemas, claro que tienes que tener alguna impresora como predterminada.
Código Delphi
[-]unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Printers,
StdCtrls;
Function GetImpresora(Impre:String):Integer;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
GetImpresora('HP Color LaserJet 2600n');
With Printer.Canvas do
begin
Printer.BeginDoc;
textout(100,100,'test');
Printer.EndDoc;
end;
end;
Function GetImpresora(Impre:String):Integer;
Var
nCont:Integer;
lSearch:Boolean;
cNewLIne:String;
begin
lSearch:=False;
cNewLine:=Chr(10)+Chr(13);
For nCont:=0 to Printer.Printers.Count - 1 do
begin
if Pos(impre, Printer.Printers[nCont]) <> 0 then
begin
lSearch:=True;
Result:=nCont;
Break;
end;
end;
if lSearch = False then
begin
Result:=-1;
ShowMessage('Impresora no encontrada:'+cNewLine+Impre+cNewLine+'Se utilizará la predefinida.');
end;
end;
end.
Si quieres que te manda el Exe, me tienes que dar tu correo.
Auf Wiedersehen