Rapid-Q Documentation by William Yu (c)1999 Appendix A: PRINTER

PRINTER Component

This object is global, and need not be created. Please note that some printers do not support Draw or CopyRect. The printer component is mainly used for graphics, although it may also be suitable for text, please refer to LPRINT for text-only printing.

Printer Properties
FieldTypeR/WDefault
AbortedINTEGERR
Aborted determintes if the user aborted the print job.
Capabilities.CopiesINTEGERR
Capabilities.Copies indicates whether the print is capable of printing multiple copies.
Capabilities.OrientationINTEGERR
Capabilities.Orientation indicates whether the print is capable of different orientations.
Capabilities.CollateINTEGERR
Capabilities.Collate indicates whether the print is capable of collating.
CopiesINTEGERRW
Number of copies to print.
CopyModeINTEGERRWcmBlackNess
FontQFONTW
FontsARRAY of STRINGR
FontsCountINTEGERR
HandleINTEGERR
OrientationINTEGERRW
Orientation determines if the print job prints vertically or horizontally on a page.
Valid orientation values are:
0 = poPortrait (Vertical print)
1 = poLandscape (Horizontal print)
PageHeightINTEGERR
PageNumberINTEGERR
PageWidthINTEGERR
PrinterIndexINTEGERRW
PrintersARRAY of STRINGR
PrintersCountINTEGERR
PrintingINTEGERR
TitleSTRINGRW
Title is the text that appears in the Print Manager and on network header pages.


Printer Methods
MethodTypeDescriptionParams
AbortSUBAbort printing the document0
BeginDocSUBStarts new document to print0
BeginDoc sends a print job to the printer.
EndDocSUBNothing is printed until this is called0
EndDoc will start the print job.
NewPageSUBStart printing on a new page0
CircleSUB (x1%, y1%, x2%, y2%, c%, fill%)Draw & Fill Circle6
CopyRectSUB (D, Image, S)D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap3
DrawSUB (x%, y%, BMP)Draw Bitmap on Canvas3
FillRectSUB (x1%, y1%, x2%, y2%, c%)Draws & Fills a rectangle5
LineSUB (x1%, y1%, x2%, y2%, c%)Draws a line5
PaintSUB (x%, y%, c%, borderc%)Fill Region4
PsetSUB (x%, y%, c%)Pixel plot3
RectangleSUB (x1%, y1%, x2%, y2%, c%)Draws a rectangle5
RoundRectSUB (x1%, y1%, x2%, y2%, x3%, y3%, c%)Draws & Fills a rounded rectangle7
StretchDrawSUB (Rect AS QRECT, BMP)Draw BMP and stretch to fit inside Rect2
TextHeightFUNCTION (Text$) AS WORDReturns the height, in pixels, of Text$ string1
TextWidthFUNCTION (Text$) AS WORDReturns the width, in pixels, of Text$ string1
TextRectSUB (Rect AS QRECT, x%, y%, S$, fc%, bc%)Write text, and clip within region Rect6
TextOutSUB (x%, y%, S$, fc%, bc%)Writes text to printer5


Printer Examples
DECLARE SUB ButtonClick

SUB ComboBoxChange(Sender AS QComboBox)
  Printer.PrinterIndex = Sender.ItemIndex   '-- Change default printer
END SUB

DIM Font AS QFont
    Font.Color = &HFF0000
    Font.Name = "Arial"
    Font.Size = 20
DIM Bitmap AS QBitmap
Bitmap.BMP = "rapidq.bmp"


CREATE Form AS QForm
  CREATE ComboBox AS QComboBox
    Left = 5
    Top = 5
    Width = 150
    OnChange = ComboBoxChange
  END CREATE
  CREATE Button AS QButton
    Caption = "&Print"
    Top = 3
    Left = 180
    OnClick = ButtonClick
  END CREATE
  CREATE GroupBox AS QGroupBox
    Caption = "Print Preview..."
    Top = 35
    Width = Form.ClientWidth
  END CREATE
  Center
END CREATE

FOR I = 0 TO Printer.PrintersCount-1
  ComboBox.AddItems(Printer.Printers(I))    '-- Add printer list to combobox
NEXT
ComboBox.ItemIndex = Printer.PrinterIndex

Form.ShowModal

SUB ButtonClick
  Printer.Orientation = 1   ' Landscape
  Printer.BeginDoc
  Printer.TextOut(1000,1000,"Hi World!",0,-1)
  Printer.Font = Font
  Printer.TextOut(10,10,"Does this print?",0,-1)
  Printer.Line(10,10,500,500,0)
  Printer.EndDoc
END SUB

Prev Component Contents Next Component
Hosted by uCoz
Hosted by uCoz