|
Respecting user printer selections before printing a preview. Sample code -
Printing from the preview or after a 'Prepare'
==============================================
These changes force the saved metafile to be printed by the current printer object,
which is selected and setup by a standard print dialog. All the users settings are
respected by the printer, including the paper dimensions, 2 per page, paper source,
resolution, collation, copies and orientation.
The new method PrintMetafileDirect may be called after a prepare like this -
quickrep1.prepare;
// you can call a printer dialog here ...
quickrep1.qrprinter.PrintMetafileDirect( 1, 6 ); // for instance.
After pasting in these changes, rebuild the libraries as described here
www.quickreport.co.uk/building.html
Changes in QRPrntr.pas
----------------------
First, move the property 'aPrinterSettings' of TQRPrinter
to the Public properties ( file qrprntr.pas).
1. Add this new public method.
Declare it here in the TQRPrinter class definition
..
..
public
// standard printer
{$ifdef VER36PRO}
constructor Create( ParentRep : TObject );
{$else}
constructor Create;
{$endif}
destructor Destroy; override;
// **** new method
procedure PrintMetafileDirect( frompage, topage : integer);
function GetPage(Value : integer) : TMetafile;
Add code body anywhere after implementation
// Called from the preview, prints the saved metafile direct to 'printer'
procedure TQRPrinter.PrintMetafileDirect( frompage, topage : integer);
var
pagefile : TMetafile;
i : integer;
qrpr : TQRPrint |