Home RAP

Setting Duplex printing using a pass thru function

edited October 2003 in RAP
Hi

I have written the following pass thru function to set the report printers
Duplexing option, the function works fine but although it does set the
duplex type it is ignored when the report is printed. All my reports are
designed using the DADE and I call this function in the BeforePrint event of
the report (note that the ShowPrintDialog property is set to false therefore
I cannot use the OnPrintDialogClose event).

Any ideas ?

Cheers

Stuart

procedure TsmbSetDuplexPrinting.ExecuteFunction(aParams: TraParamList);
var
lsResult: Boolean;
obReportObject: TppReport;
DuplexType : TppDuplexType;
begin
lsResult := False;

GetParamValue(0, obReportObject);
GetParamValue(1, DuplexType);

With obReportObject.PrinterDevice.Printer.PrinterInfo do
If ppPrintr.DeviceCapabilities(Device, Port, DC_DUPLEX, nil, nil) = 1 then
begin
obReportObject.PrinterDevice.Printer.PrinterSetup.Duplex := DuplexType;
lsResult := True;
end;

SetParamValue(2, lsResult);
end; {Procedure ExecuteFunction}

Comments

  • edited October 2003

    Due to the timing of the Report.BeforePrint you have to set

    Report.Engine.Page.PrinterSetup


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2003
    Thanks Nard,

    I new it had to be something simple.

    Cheers

    Stuart
This discussion has been closed.