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

Changing page setup according to the printer

edited May 2004 in End User
Hello there!
I have some problems printing my reports to different printers.

For example, I have a custom (8,5"x11") size report which is usually sent to
a dot matrix printer with continuous paper. When I try to send it to a laser
printer which expects A4, I have error messages telling me to press buttons
on the actual printer, and only then the report prints.
Or when I have an A3 report, and send it to a dot matrix with custom large
paper (13,5" x 11" in.), it is printed vertically on the page!.

My question is: How can I surpass the default page setup of a report and
select how I want to print it, right before sending it to the printer!? Just
like a word document behaves? Is it possible?

Thank you in advance
Mirto

Comments

  • edited May 2004

    In ReportBuilder you use the PrinterSetup properties to specify the Page
    size, Margins, Orientation, etc. These settings are applied to the printer
    when you print the report.

    (As a test, I created an A4 document in Word. To do this I had to configure
    the printer setup. In Word there is a page setup, but with the printer set
    to Letter and the page setup set to A4, I could not create a true A4 sized
    document. My bottom margin had to be very large. So Word is playing a few
    tricks.)

    Prior to calling Report.Print you could try upating the Report.PrinterSetup
    properties to reflect the default paper size of the destination printer. See
    the following article.


    --------------------------------------------------
    Tech Tip: Windows Default Printer Settings
    ---------------------------------------------------

    1. Default Printer Name

    You can get the name of the computers default
    printer by accessing ReportBuilder's global
    printer list object - ppPrinters.


    uses
    ppPrintr;


    var
    lsPrinterName: String

    begin

    lsPrintername := ppPrinters.DefaultPrinterName;

    end;



    2. Default Printer Setup


    Place the following code in the OnClick event-handler
    of a button on a form. When the button is pressed
    a message will be displayed showing the default
    printer name and paper size.

    You can get the other document defaults via
    the TppPrinter.PrinterSetup properties.


    uses
    ppPrintr;

    var
    lPrinter: TppPrinter;

    begin

    lPrinter := TppPrinter.Create;

    lPrinter.PrinterName := ppPrinters.DefaultPrinterName;

    ShowMessage(ppPrinters.DefaultPrinterName + ': ' +
    lPrinter.PrinterSetup.PaperName);

    {assign default printer settings to a report}
    myReport.PrinterSetup := lPrinter.PrinterSetup;


    lPrinter.Free;

    end;


    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com



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


    Best regards,

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