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

Retaining Printer Properties set by user

edited July 2009 in General
Hi

I have an invoice printing routine which loops through a batch of invoices
and changes the .rtm to the correct template for the invoice before using
Template.LoadFromFile and printing the invoice.

I display the Print Dialog on the first invoice and then supress it for
subsequent invoices using the following code:-


if j > 0 then
begin
ppViewer1.Report.ShowPrintDialog := FALSE;
PrinterSetup.PrinterName := MyPrinter;
PrinterSetup.Copies := MyCopies;
end;

This works very well except for when the user changes the printer properties
from the default i.e. selects Greyscale insted of Colour.

The first invoice prints in greyscale but then all subsequent invoices print
in colour.

Can you please advise how I would retain all the values set by the user for
this print run.

Thanks in advance

Philip L Jackson

By the way everyone really likes the new alignment features of 11.xx

Comments

  • edited July 2009

    RB 11 has a new PrinterSetup.DeviceSettings property that contains the
    complete printer setup DevMod structure - which includes all custom
    settings/features that the printer supports. There are also new methods for
    saving DeviceSettings to file and stream.

    Try creating a memory stream and using
    PrinterSetup.SaveDeviceSettingsToStream and LoadDeviceSettingsFromStream.

    uses
    ppPrintr;

    // show printer dialog

    // save device settings

    PrinterSetup.SaveDeviceSettingsToStream (myMemStream);

    // then for the other reports

    myMemStream.Position := 0;
    PrinterSetup.LoadDeviceSettingsFromStream(myMemStream);


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



    Best regards,

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

    Works very well.

    Regards

    Philip L Jackson


This discussion has been closed.