Saving Printer settings almost works (D6, RB10 WIN XP)

edited October 2009 in Devices
Hi

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.

I originally replied to the thread but do not know how you see it or whether
you do so I have added a new thread.

Regards
Andrew



Comments

  • edited October 2009

    Report.PrinterSetup --> Page.PrinterSetup --> PrinterDevice.PrinterSetup

    The flow and control of the PrinterSetup object originates with the report.
    (Each report and childreport has a PrinterSetup object). Each Page generated
    by the report has a PrinterSetup object. This enables a report to produce
    Pages with different dimensions, orientations (landscape, portrait), output
    to different paper trays, etc.

    So what is happening in your case is that once you start the print job, the
    Pages are received by the PrinterDevice and the Page.PrinterSetup is applied
    to configure the printer.

    For RB 11 there is a new OnPrinterDeviceStateChange event that is fired by
    the PrinterDevice before/after the print job starts/ends and before/after
    each page. The timing is such that it could be used to override the
    printersetup properties for each Page.

    example:

    uses
    ppTypes;

    procedure TForm2.rsClientReport1PrinterDeviceStateChange(Sender: TObject;
    aStateChange: TppDeviceStateType);
    begin

    if (aStateChange = dsBeforeStartPage) then
    rsClientReport1.PrinterDevice.Printer.PrinterSetup :=
    rsClientReport1.PrinterSetup;


    end;


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

    Best regards,

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

    Can I explain what I am trying to achieve as I think I have sent you in the
    wrong direction.

    Our system has reports (client calls them documents as they go out to
    customers) which they need to send out to a group of customers with the
    least manual effort as possible. Our client uses the system to sell tours
    upon which 20/30 bookings can be made and therefore they require the
    Itinerary report to be produced 1 for each booking.

    To achieve this we have setup a batch print which collects all the bookings
    for a given tour together and will run through each booking printing the
    itinerary for each booking. I do this in a loop and each booking is a
    seperate report print command. I am not doing all the bookings together in
    some kind of bkg_id in (.....) way. So I have

    while not EOF do
    begin
    ..
    ..
    ..
    print;
    ..
    end

    Now doing this I only show the printer dialog once for the first booking and
    the client chooses the printer and the properties and the system then prints
    to the bottom of the list. Now all works well for the first itinerary but
    all the rest default back to the standard properties for the printer
    although with the method you gave me previously I was able to keep it going
    to the selected printer. So the question is how do I preserve the properties
    as well between each successive print? As the method I use only seems to
    preserver the printer chosen.

    I hope that makes it a little cleare.

    Regards
    Andrew


  • edited October 2009

    You might try using the ClientReport.OnInitializePrinterSetup event to set
    the ClientReport.PrinterSetup properties. (Set ClientReport.SavePrinterSetup
    to False)

    If you want to create a simple demo project - perhaps start with the
    Demos\Clients\ClientReport example and modify it to duplicate what you are
    trying to accomplish, you can send it to support@ in zip format and I run
    here in the debugger and look at it.



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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.