How to change the printer in FR ?

Hi,

I can get the printer(s) List by using Delphi 6 Pro as the following code.

uses
printers

ComboBox1.Items.Assign(Printer.Printers);

But, I don't know how to change the properity of a frReport for the user selection!

The default printer selection dialog cannot be made a filter for our need ( e.g. print to a Fax printer, PDF printer, PostScript enabled printer or Dot-Martix printer ).

Would you give me some advice ?

Thank you very much in advance !!!

Regards,
Nelson.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 6:15PM
    Use the TFRReport.ChangePrinter(OldIndex,NewInde:Integer):Boolean
    function to change the output printer without using any customizable
    printer setting dialogs. The parameters are the same as the reference
    indexes in the Printer.Printers array. My preferred way to implement
    this on the GUI: populate a combobox with the Printer.Printers list and
    then let the user choose one from the list.

    So:

    Uses System,....,...,Printers;

    YourForm.OnCreate(Sender:TObject);
    Begin
    PrinterCombo.Items.Assign(Printer.Printers);
    End;

    TYourForm.PrintButtonClick(Sender:TObject);
    Begin
    Report.LoadFromFile(...);
    Report.ChangePrinter(-1, PrinterCombo.ItemIndex);
    Report.Prepare;
    ...etc.
    End;

    -1 for the OldIndex parameter cause the report to use the original
    index, so You don't need to know the previous index.

    ;)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.