PrinterSetup and archives
I have reports being printed to archive files. I then want to be able to
select a number of these reports and print them to a printer. I only want to
ask for the printer once so I am using a Delphi TPrintDialog. I am then
trying to assign the properties as follows (this is just one version of it,
I have tried a few ). Basically the PrinterName looks to be set correctly
but the report is still printed to the Default printer. Any suggestions as
to what I am doing wrong?
Thanks
Jeff
varPrinterSetup := TppPrinterSetup.Create(nil);
try
varPrinterSetup.Copies := varPrint.Copies;
varPrinterSetup.PrinterName := Printer.Printers[Printer.PrinterIndex];
varPrinterSetup.Orientation := Printer.Orientation;
varPrinterSetup.Collation := varPrint.Collate;
ppArchiveReader1.DeviceType := 'Printer';
ppArchiveReader1.ArchiveFileName := FstrPreviewFile;
ppArchiveReader1.ShowCancelDialog := False;
ppArchiveReader1.ShowPrintDialog := False;
ppArchiveReader1.PrinterSetup.Assign(varPrinterSetup);
ppArchiveReader1.Print;
finally
varPrinterSetup.Free;
end;
select a number of these reports and print them to a printer. I only want to
ask for the printer once so I am using a Delphi TPrintDialog. I am then
trying to assign the properties as follows (this is just one version of it,
I have tried a few ). Basically the PrinterName looks to be set correctly
but the report is still printed to the Default printer. Any suggestions as
to what I am doing wrong?
Thanks
Jeff
varPrinterSetup := TppPrinterSetup.Create(nil);
try
varPrinterSetup.Copies := varPrint.Copies;
varPrinterSetup.PrinterName := Printer.Printers[Printer.PrinterIndex];
varPrinterSetup.Orientation := Printer.Orientation;
varPrinterSetup.Collation := varPrint.Collate;
ppArchiveReader1.DeviceType := 'Printer';
ppArchiveReader1.ArchiveFileName := FstrPreviewFile;
ppArchiveReader1.ShowCancelDialog := False;
ppArchiveReader1.ShowPrintDialog := False;
ppArchiveReader1.PrinterSetup.Assign(varPrinterSetup);
ppArchiveReader1.Print;
finally
varPrinterSetup.Free;
end;
This discussion has been closed.
Comments
The printersettings are saved down separately in each page of an archive so
when you initially set them before you print, they are getting reset to the
original settings. To work around this issue, simply place your code below
inside the TppArchiveReader.OnInitializePrinterSetup event. This will
define the printer setup for each page in the archive.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com