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

Presetting Printer for Preview Archivereader

edited November 2010 in General
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

Comments

  • edited November 2010
    Hi Oalf,

    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
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2010
    Am Wed, 10 Nov 2010 07:01:35 -0700 schrieb Nico Cizik (Digital Metaphors):

    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
  • edited November 2010
    Hi 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
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2010
    Hi Nico,

    i thought, this is a basic function and i make a simple mistake.
    Can i send a sample application to you?

    Regards, Olaf
  • edited November 2010
    If you would like I can test it here. Send the example to
    support@digital-metaphors.com in .zip format.



    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2010
    Hi, Nico

    thanks for the fast response and the patch.
    It works fine.

    Regards, Olaf
This discussion has been closed.