[lazarus] TPrinter

andrew johnson acjgenius at earthlink.net
Fri Nov 1 16:20:38 EST 2002


Nope, but I got D4, and I do not think there are many differences(if any
at all). This what I get According to the Help Files properties and
methods:

  TPrinterOrientation = (poPortrait, poLandscape);
  TPrinterCapability = (pcCopies, pcOrientation, pcCollation);
  TPrinterCapabilities = set of TPrinterCapability;

  TPrinter = class(TObject)
  {everything is public}
  public   
    procedure Abort;//aborts print
    
    procedure BeginDoc; //initialize printer, or PS header info and
start first page
    procedure EndDoc; //Finish Document, cleanup etc.
    procedure NewPage;//start a new page

    {I have no idea what these 2 are, or if you should care}

    procedure GetPrinter(ADevice, ADriver, APort: PChar; var
ADeviceMode: THandle);
    procedure SetPrinter(ADevice, ADriver, APort: PChar; ADeviceMode:
THandle);

    property Aborted: Boolean;//(RO) has the document been aborted via
abort function or internal error
    property Canvas: TCanvas;//(RO) canvas drawn too
    property Capabilities: TPrinterCapabilities;//(RO) what printer
supports by way of advanced features
    property Copies: Integer;//(RW) hw many copies too print
    property Fonts: TStrings;//(RO) what fonts Printer
supports(internally), probably can be ignored
    property Handle: HDC;//(RO) windows physical handle, will probably
be usefull if Printing is ever added to the interface backend, but other
wise probably ignore
    { these are the obvious page properties }
    property Orientation: TPrinterOrientation;//(RW) 
    property PageHeight: Integer;//(RO)
    property PageWidth: Integer;//(RO)
    property PageNumber: Integer;(RO)

    property PrinterIndex: Integer;//(RW) current page being written too
    property Printing: Boolean;//(RO) is it currently printing, aka has
BeginDoc been called
    property Printers: TStrings;//(RO) what printers are available in
the system, I do not know why this is part of the component and not its
own routine
    property Title: string;//(RW) Title Windows refers to Print Job as
  end;

AFAIK these are the only other(important) things in D4 Printer.pas :

function Printer: TPrinter;//get the currently assigned printer
function SetPrinter(NewPrinter: TPrinter): TPrinter;//Change current
printer

procedure AssignPrn(var F: Text);//assign a file to the current printer
so that whatever is written to the file is written to the
printer(CR/Writeln at the end of the Document will autmatically call
newpage)

hope this helps! But as you can see Delphi(or win32) doesn't provide any
nice way of handling the setting of the printer, so you can add
properties and so forth without too much worry of compatibility.

Andrew

On Fri, 2002-11-01 at 15:30, Tony Maro wrote:
> I'm considering starting work on a TPrinter object that for starters will
> generate postscript output.
> 
> Does anyone have a D5 or later object definition for a TPrinter that I could
> look at for compatibility reasons?






More information about the Lazarus mailing list