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

Printer defaults

edited August 2007 in General
Hi Guys,

I was wondering if there is a way for report designer to use the
windows printer settings for duplexing rather than having it setup on the
report?

Regards,



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited August 2007

    Here is a tech tech that shows how to get the Windows default PrinterSetup
    info. The example shows how to get the paper name, I think the same
    technique will work for the duplex setting.


    --------------------------------------------------
    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
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2007
    Thanks that appears to be working good.

    Regards,
    Brenton McSweyn



    PrinterSetup



    --- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.