Using the Printer setup dialog in QR4
The printer setup dialog may be called from the preview or in code.
Behaviour is different in each case. From the preview the user can change
the immediate printer settings.
In code, the programmer does it explicitly.
From the preview
In this case the report document has been stored in a temp file or in memory.
If the user opens the print setup dialog from the preview, then on closing it, the
current settings of the dialog will be used in the print initiated by the print button.
A print from this button will always send the stored document to the printer and NOT
recreate the report.
This means that the user may change the printer, paper source (bin), print quality, collate
and so on. for this print operation, but the underlying design values will not have
changed, so if the report were to be recreated, the design values will come back into force.
Preparing or Printing
In either case the report will be generated anew, and the design printersettings will
be imposed on any subsequent call to Quickreport.Print or QRPrinter.Print.
If a developer want the user to have the option of changing the printer settings,
a call to Quickreport.PrinterSetup must be made. When the dialog closes, the users
preferences can be accessed via the new property of TCustomQuickrep called
'UserPrinterSettings'.
For example, here the user may change the paper source before the print -
ReportForm.Quickrep1.PrinterSetup;
ReportForm.Quickrep1.PrinterSettings.Outputbin := TQRBin( ReportForm.Quickrep1.UserPrinterSettings.CustomBincode);
ReportForm.Quickrep1.Print;
In the case of printing after a prepare, this code will suffice,
ReportForm.Quickrep1.PrinterSetup;
ReportForm.Quickrep1.PrinterSettings.Outputbin := TQRBin( ReportForm.Quickrep1.UserPrinterSettings.CustomBincode);
ReportForm.Quickrep1.Prepare;
ReportForm.Quickrep1.QRPrinter.Print;
ReportForm.Quickrep1.QRPrinter.Free;
ReportForm.Quickrep1.QRPrinter := Nil;
The following fields of UserPrinterSettings are set in the Printersetup dialog.
CustomBinCode ( this is the 'raw' bin code from the printer)
ExtendedDuplex ( raw duplex code from the printer)
PrintQuality
Collate
ColorOption
Copies
Orientation
FirstPage
LastPage
OutputBin
CustomPaperCode ( raw code from the printer )
PrinterIndex