Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

PrintToDevices and PrinterSetup.Copies

edited January 2005 in General
I am using the PrintToDevices method because I have my only print dialog box
which allows the user to modify the report and printer settings. I use the
code below, which I think originally came from the tech-tips. The problem is
that no matter what I set the value of Report1.PrinterSetup.Copies to, it
only ever prints 1 copy (note: the property Report1.PrinterSetup.Collation
is set to True). If I use the print method then I get the right number of
copies.

var
aDevMode: THandle;
lPrinterDevice: TppPrinterDevice;
begin
Report1.Printer.GetDevMode(aDevMode);
lPrinterDevice := TppPrinterDevice.Create(nil);
lPrinterDevice.Publisher := Report1.Publisher;
lPrinterDevice.Printer.SetDevMode(aDevMode);

Report1.PrintToDevices;

lPrinterDevice.Free;
end;

Comments

  • edited February 2005
    After a bit of thought I realised I can work around the problem if I put the
    following line of code in before I call PrintToDevices :

    lPrinterDevice.Printer.PrinterSetup.Copies := Report1.PrinterSetup.Copies;


This discussion has been closed.