tengo el siguiente codigo:
procedure ActivaImpresora(const s: string);
var
Device, Name, Port : array[0..100] of char;
DevMode : THandle;
begin
with printer do begin
if s<>'' then begin
PrinterIndex :=printers.IndexOf(s);
end
else
PrinterIndex := -1;
GetPrinter(Device, Name, Port, DevMode);
SetPrinter(Device, Name, Port, 0);
end;
end;
----------------------------------------------------------------------------------------------
procedure TPiezasFrm.EtiquetaBtnClick(Sender: TObject);
var Prn : TPrn;
t : integer;
begin
t:= 1;
uno:= 2;
dos:= 4;
tres:= 5;
cuatro:= 6;
cinco:= 7;
par:= false;
VerConjuntos.Close;
VerConjuntos.ParamByName('codigo').AsString := PiezasREF_N.AsString;
VerConjuntos.ParamByName('c_vr').AsString := PiezasVRSION.AsString;
VerConjuntos.Open;
If not VerConjuntos.IsEmpty then begin
ActivaImpresora(Principal.PrnEtiqueta);
Prn.Init(Printer.Canvas,'Arial',10,true);
Prn.EscalaSep(1,1.0);
Printer.Orientation := poPortrait;
Printer.BeginDoc;
VerConjuntos.first;
while t<=8 do begin
while not VerConjuntos.Eof do begin
if (t>1) and (par=false) then begin
uno:=uno+7;
dos:=dos+7;
tres:=tres+7;
cuatro:=cuatro+7;
cinco:=cinco+7;
end;
ImprimeUnaEtiqueta(Prn,VerConjuntosCANT.AsInteger);
if par=false then begin
par:=true;
VerConjuntos.Next;
end
else begin
par:=false;
VerConjuntos.Next;
break;
end;
end;
inc(t);
end;
ActivaImpresora('')
end;
end;