Change Printer in RAP
G'day,
I acted on an earlier Post by Martin Schmid in regards to changing the
printer in RAP.
I have created a passthrough function that allows me to give the required
printername within the ReportBeforePrint event in the RAP. I have placed a
breakpoint in my Delphi code to which the function calls and can confirm
that the correct printer name is getting through and is being assigned
using:
x := ppReport1.PrinterSetup.PrinterNames.IndexOf(PName);
with ppReport1.Engine.Page.PrinterSetup do
PrinterName := ppReport1.PrinterSetup.PrinterNames[x];
I acted on an earlier Post by Martin Schmid in regards to changing the
printer in RAP.
I have created a passthrough function that allows me to give the required
printername within the ReportBeforePrint event in the RAP. I have placed a
breakpoint in my Delphi code to which the function calls and can confirm
that the correct printer name is getting through and is being assigned
using:
x := ppReport1.PrinterSetup.PrinterNames.IndexOf(PName);
with ppReport1.Engine.Page.PrinterSetup do
PrinterName := ppReport1.PrinterSetup.PrinterNames[x];
This discussion has been closed.
Comments
I tried 2 attempts at assigning the printer name at print time:
with ppReport1.Engine.Page.PrinterSetup do
PrinterName := PName
as well as that in the last post. Each way just results in the report being
sent to the default printer in the IDE or when the exe is run in Terminal
Services I get the message Screen Printing does not support Printer. Which
I gather are both the results of not having a valid Printer Name assigned.
I researched this further. The approach of setting
Report.Engine.Page.PrinterSetup will work for most properties such as
Orientation, Bin, etc.
However, looks like a different approach is required for the PrinterName -
it is used to start the print job.
Try this in a Delphi event-handler first and then move it to a RAP pass-thru
function:
uses
ppPrnDev;
procedure MyReportBeforePrint(Sender: TObject);
begin
{check whether we are printing to the printer}
if (Report.PrinterDevice <> nil) then
begin
myReport.PrinterDevice.Printer.PrinterSetup.PrinterName :=
myReport.PrinterSetup.PrinterNames[liIndex] ;
end;
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com