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

Using TppProducer.SavePrinterSetup

edited July 2009 in Devices
Hi

D6.02 RB10 XP Pro

I have a need to print a batch of documents through report builder. All
works well with the looping and the printer except 1 thing. I only allow the
printer dialog to appear the first time so they can select the printer and
setup they want and then proceed to print what could be 30 or 40 documents.
I thought I was OK as I was using SavePrinterSetup := True but it does not
retain the settings.

// Preserve the selected printer for this instance
reportViewer.clrMain.SavePrinterSetup := True;

clrMain is a TrsClientReport class it is also retained for each loop
iteration so I am talking about the same instance and not freeing it.

The documents are Travel Itineraries and there is 1 for each booking for a
specifc tour so I loop through the dataset and change the id of the booking
for each iteration.

Is this property not working? If it is can you suggest why it does not work
for me?

Regards
Andrew

Comments

  • edited July 2009

    Each time ClientReport receives a Page object from the server, it is
    updating itself...

    Self.PrinterSetup := Page.PrinterSetup;

    You migh try creating a separate instance of TppPrinterSetup and use that to
    manually save/assign.

    Here is an idea (warning - I did not try to compile this, it meant to be an
    idea)

    uses
    ppPrintr;

    - Declare a private FSavePrinterSetup in the declaration of the Form
    containing the ClientReport.

    FSavePrinterSetup: TppPrinterSetup;

    - Use the ClientReport.BeforePrintEvent to save it the first time...

    if (ClientReport.PrinterDevice <> nil) and (FSavePrinterSetup= nil) then
    begin
    FSavePrinterSetup:= TppPrinterSetup.Create(nil);
    FSavePrinterSetup.Assign
    (ClientReport.PrinterDevice.Printer.PrinterSetup);
    end;

    - Before you call to Print, assign the printersetup

    if (FSavePrinterSetup <> nil) then
    ClientReport.Printersetup := FSavePrinterSetup;

    ClientReport.Print;



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2009
    Nard

    I tried this and it worked with regard to the actual printer selected.
    However it does not seem to cover specific settings that I make in the
    Properties dialog of the printer. For instance DUPLEX or multiple pages per
    page. It works fine for the first print but all the rest are back to the
    default properties.

    Any ideas?

    I have tried various events to set the save settings back and they are
    clearly working to a point as each document goes to the printer I selected
    just the properties seem to reset.

    Regards
    Andrew



This discussion has been closed.