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

Printer Setup

edited December 2003 in General
Hi,

Is it possible to get the paper Name from the default printer?
At the moment the Paper Name is hard coded into the report with the default
being as Letter (8.5 x 11 in). If the printer is set as A4 the user need to
change it on every report or select the paper name at the time of print
(which is not an option cause they have to remember to do every time).
I am thing of setting it in code with something like this

Report.PrinterSetup.PaperName := ??? (i.e. default printer dot PaperName)

Regards

NB

Comments

  • edited December 2003
    --------------------------------------------------
    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;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.