Description: String;
Description: string;
The Description property determines printer description.
The printer description contains the name of the printer, the driver, the port and the number of copies.
Executing the example requires that the repository contains a regular report with the REPORT identifier.
Add links to the Drawing, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Printer: IGxPrinter;
DocPrint: IGxDocumentPrinter;
PrComment: IGxPrintComment;
PrDesc: IGxPrinterDescription;
Docum: IGxDocument;
Begin
// Get current repository
MB := MetabaseClass.Active;
// Get regular report
Docum := MB.ItemById("REPORT").Bind As IGxDocument;
// Get a printer installed as default in OS
Printer := GxPrinters.DefaultPrinter;
DocPrint := Printer As IGxDocumentPrinter;
PrComment := New GxPrintComment.Create;
// Print regular report
Docum.Print(DocPrint, 0, 0, "");
PrDesc := PrComment.PrinterDescription;
PrDesc.Description := DocPrint.Description;
// Display printer description
Debug.WriteLine(PrDesc.Description);
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Drawing;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Printer: IGxPrinter;
Printers: GxPrintersClassClass = New GxPrintersClassClass();
DocPrint: IGxDocumentPrinter;
PrComment: GxPrintComment = New GxPrintCommentClass();
PrDesc: IGxPrinterDescription;
Docum: IGxDocument;
Begin
// Get current repository
MB := Params.Metabase;
// Get regular report
Docum := MB.ItemById["REPORT"].Bind() As IGxDocument;
// Get a printer installed as default in OS
Printer := Printers.DefaultPrinter;
DocPrint := Printer As IGxDocumentPrinter;
// Print regular report
Docum.Print(DocPrint, 0, 0, "", True);
PrDesc := PrComment.PrinterDescription;
PrDesc.Description := DocPrint.Description;
// Display printer description
System.Diagnostics.Debug.WriteLine(PrDesc.Description);
End Sub;
After executing the example a regular report will be printed and description of the printer installed by default in OS is displayed.
See also: