Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Error imprimiendo: "printing in progress" (https://www.clubdelphi.com/foros/showthread.php?t=27886)

jmlifi 02-12-2005 15:13:37

Error imprimiendo: "printing in progress"
 
Código Delphi [-]
 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 Verconjuntos.IsEmpty then
      //imprimeetiquetas(0);
    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;

ActivaImpresora(Principal.PrnEtiqueta) no tengo problemas, pero todavía no me llega a imprimir
ActivaImpresora('') PrinterIndex coge valor -1 y me salta el error "printing in progress". si comento esta parte, la impresosa me marca 1 documento ha imprimir pero no me imprime nada. Cuando cierro la aplicacion es cuando imprime.

luisgutierrezb 02-12-2005 15:28:50

creo que te falta el Printer.EndDoc que es cuando ya manda a imprimir...

vtdeleon 02-12-2005 16:06:58

Saludos

jmlifi Usar Etiquetas vB:=Delphi-SQL

Mira que bien se ve tu post ahora.


La franja horaria es GMT +2. Ahora son las 18:57:33.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi