Send ESC to the printer from RAP with Passthrough
Hello,
i have looked the PrinterEscapeCommands.zip file and made a passthrogh with
it.
Then i had used this in RAP in the OnStartPage Event, but it seems that it
does nothing. Is it possible to make use it also frtom RAP in this way? Also
is it possible to use other Events to send Escapes to the Printer? So
Cashdriver could open on Printer finish and so on.
// Passthrough
class function TmyEscapeFunction.GetSignature: String;
begin
Result := 'function Escape(var Report : TppReport; const ESC: String):
Boolean;';
end;
procedure TmyEscapeFunction.ExecuteFunction(aParams: TraParamList);
const
MaxESC = 128;
type
TppEscapeDataRec = packed record
DataLen: Word;
DataBuf: Array [0..MaxESC] of Char;
end;
var
lsReport : TppReport;
lsESC : String;
lsResult : Boolean;
lEscapeDataRec: TppEscapeDataRec;
begin
lsReport:=nil;
lsESC:='';
LsResult:=false;
GetParamValue(0,lsReport);
GetParamValue(1,lsESC);
if (lsReport.PrinterDevice<>nil) then
if (Length(lsESC)<=MaxESC) and (Length(lsESC)>0) then
begin
lEscapeDataRec.DataLen:=Length(lsESC);
StrLCopy(lEscapeDataRec.DataBuf, PChar(lsESC), MaxESC);
lsResult:=Escape(lsReport.Printer.Canvas.Handle, PASSTHROUGH, 0,
@lEscapeDataRec, nil)>=0;
lsResult:=true;
end else
else lsResult:=true;
SetParamValue(2, lsResult);
end;
--
best regards
chris (EULANDA)
www.eulanda.com
ERP SOLUTIONS
i have looked the PrinterEscapeCommands.zip file and made a passthrogh with
it.
Then i had used this in RAP in the OnStartPage Event, but it seems that it
does nothing. Is it possible to make use it also frtom RAP in this way? Also
is it possible to use other Events to send Escapes to the Printer? So
Cashdriver could open on Printer finish and so on.
// Passthrough
class function TmyEscapeFunction.GetSignature: String;
begin
Result := 'function Escape(var Report : TppReport; const ESC: String):
Boolean;';
end;
procedure TmyEscapeFunction.ExecuteFunction(aParams: TraParamList);
const
MaxESC = 128;
type
TppEscapeDataRec = packed record
DataLen: Word;
DataBuf: Array [0..MaxESC] of Char;
end;
var
lsReport : TppReport;
lsESC : String;
lsResult : Boolean;
lEscapeDataRec: TppEscapeDataRec;
begin
lsReport:=nil;
lsESC:='';
LsResult:=false;
GetParamValue(0,lsReport);
GetParamValue(1,lsESC);
if (lsReport.PrinterDevice<>nil) then
if (Length(lsESC)<=MaxESC) and (Length(lsESC)>0) then
begin
lEscapeDataRec.DataLen:=Length(lsESC);
StrLCopy(lEscapeDataRec.DataBuf, PChar(lsESC), MaxESC);
lsResult:=Escape(lsReport.Printer.Canvas.Handle, PASSTHROUGH, 0,
@lEscapeDataRec, nil)>=0;
lsResult:=true;
end else
else lsResult:=true;
SetParamValue(2, lsResult);
end;
--
best regards
chris (EULANDA)
www.eulanda.com
ERP SOLUTIONS
This discussion has been closed.
Comments
Are you able to get the PrinterEscapeCommands example to work correctly in
Delphi? If so, try tracing through that code to be sure that all the same
code is being properly fired at the correct time when you move it to RAP.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com