Choose printer manualy
Is it possible to setup printer manualy? I want to you use procedure PrintPreparedReport, but there as parameter is no printer where to be printed the report (report will be printed on the default printer).
Comments
Did you use PrintPreparedReportDlg?
Or did you use Delphi's PrinterSetupDialog?
There are 2 important method of TFRReport. They are:
- ChangePrinter(OldIndex,NewInde:Integer); and
- PrintPreparedReport(PageNumbers: String; Copies: Integer;
Collate: Boolean; PrintPages: TfrPrintPages);
//TfrPrintPages = (frAll, frOdd, frEven);//
The first method changes the actually selected printer to the newly selected printer. These indexes can be obtained from the Printer:TPrinter object Printers:TStrings property. If You pass -1 to the NewIndex it will select the default printer. I usually provide the user the following GUI: there is a TComboBox with Items property assigned to the Printer.Printers list. This assignment fills the combo with the list of installed printers. That list is populated using the printerindex order. So You can assign the combo's ItemIndex property to the ChangePrinter's NewIndex parameter. After this call PrintPreparedReport. I think only the first parameter needs explanation. That is a string containing individual values or ranges like in standard print dialogs. I hope this helps.
Regards:Alex;
I use the Delphi PrinterSetupDialog.
It sets the default Printer (and bin!) for the Application.
FastReport uses the default printer so I can set the printer for my report.
The problem is that I want to set the bin for the printer to use in my report.
I make large series of invoices having the letter and address on page 1 and the amount to pay on page 2. Page 1 uses an other paper then page 2.
Someone gave me this code to change bin:
But it doesn't function at all, so there must be a error in it.
These lines are false:
. frreport1.Pages.Pages[0].pgBin := prn.GetBinIndex(listbox1.itemindex);
. frReport1.Pages.Pages[1].pgBin := prn.GetBinIndex(listbox2.itemindex);
The correct lines are:
. frReport1.Pages.Pages[0].pgBin := prn.Bins[listbox1.itemindex];
. frReport1.Pages.Pages[1].pgBin := prn.Bins[listbox2.itemindex];