Presetting Printer for Preview Archivereader
Hi,
i load a report via the archive-reader.
I like to preset a special printer for the preview.
In the FormCreate i have:
...
cbPrinter.Items := ppArchiveReader1.PrinterSetup.PrinterNames;
(ComboBox)
...
In the procedure
ppArchiveReader1InitializePrinterSetup i have:
...
ppArchiveReader1.PrinterSetup.PrinterName := sPrinter;
...
In the procedure
ppArchiveReader1PrintDialogClose i have:
...
sPrinter :=
TppPrinter(ppArchiveReader1.PrintDialog.Printer).PrinterSetup.PrinterName;
...
For the PrintButton i have:
...
ppArchiveReader1.ShowPrintDialog := True;
sPrinter := cbPrinter.Text;
ppArchiveReader1.Print;
...
When i press the PrintButton, the preview appears and when i press in the
preview the print-button the PrintDialog comes up with the preselected
printer from the combobox.
When i change the printerselection and print now, the report will printed
on the default-printer and not on the selected printer.
Why?
Where ist my mistake?
Best Regards
Olaf
Delphi 7
RB 11.08
i load a report via the archive-reader.
I like to preset a special printer for the preview.
In the FormCreate i have:
...
cbPrinter.Items := ppArchiveReader1.PrinterSetup.PrinterNames;
(ComboBox)
...
In the procedure
ppArchiveReader1InitializePrinterSetup i have:
...
ppArchiveReader1.PrinterSetup.PrinterName := sPrinter;
...
In the procedure
ppArchiveReader1PrintDialogClose i have:
...
sPrinter :=
TppPrinter(ppArchiveReader1.PrintDialog.Printer).PrinterSetup.PrinterName;
...
For the PrintButton i have:
...
ppArchiveReader1.ShowPrintDialog := True;
sPrinter := cbPrinter.Text;
ppArchiveReader1.Print;
...
When i press the PrintButton, the preview appears and when i press in the
preview the print-button the PrintDialog comes up with the preselected
printer from the combobox.
When i change the printerselection and print now, the report will printed
on the default-printer and not on the selected printer.
Why?
Where ist my mistake?
Best Regards
Olaf
Delphi 7
RB 11.08
This discussion has been closed.
Comments
When setting printer options with the Archive Reader, you need to use the
OnInitializePrinterSetup event. This will ensure your settings are honored
when printing the Archive file.
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Hi Nico,
I used this procedure (see below - i wrote already in the last message):
procedure TForm1.ppArchiveReader1InitializePrinterSetup(Sender: TObject);
begin
ppArchiveReader1.PrinterSetup.PrinterName := sPrinter;
end;
But it will not work.
Regards, Olaf
In my testing with your exact code and RB 12.02, everything seems to
function correctly. If I preview an archive, then load the print dialog and
change the printer to something different than the one selected in the
combobox at the beginning, the archive is printed to the new selection
properly. Perhaps download a trial edition of RB 12.02 and see if that
solves the problem.
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
i thought, this is a basic function and i make a simple mistake.
Can i send a sample application to you?
Regards, Olaf
support@digital-metaphors.com in .zip format.
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
thanks for the fast response and the patch.
It works fine.
Regards, Olaf