comp • gb.qt4 • printer

Printer (gb.qt4)

This class allows to print documents on printers, or save them in a file.

This class is
Create a new Printer object.
creatable
.

Static properties

Constants
Return the name of the default printer.
Default  
Return the list of printers.
List  
Paper size of 297 × 420 mm.
A3  
Paper size of 210 × 297 mm, 8.26 × 11.69 inches.
A4  
Paper size of 148 × 210 mm.
A5  
Paper size of 182 × 257 mm, 7.17 × 10.13 inches.
B5  
Custom paper size.
Custom  
Paper size of 7.5 × 10 inches, 191 × 254 mm.
Executive  
Both sides of each sheet of paper are used for printing. The paper is turned over its horizontal edge.
Horizontal  
The page's width is greater than its height.
Landscape  
Paper size of 8.5 × 14 inches, 216 × 356 mm.
Legal  
Paper size of 8.5 × 11 inches, 216 × 279 mm.
Letter  
The page's height is greater than its width.
Portrait  
Simplex  
Both sides of each sheet of paper are used for printing. The paper is turned over its vertical edge.
Vertical  

Properties

Methods Events
Return or set if multiple copies are collated or not.
CollateCopies  
Return or define the number of pages in the printed document.
Count  
Return or set the printing duplex mode.
Duplex  
Return or set the first page that must be printed.
FirstPage  
Return or set if drawing page will be done inside the margins (FullPage is FALSE), or on the entire page (FullPage is TRUE).
FullPage  
Return or set if printing is done by using gray scale, or full colors.
GrayScale  
Return or set the last page that must be printed.
LastPage  
Return or set the printer name.
Name  
Return or set the number of copies that will be printed.
NumCopies  
Return or set the printing orientation.
Orientation  
Return or set the path of the PDF or PostScript output file.
OutputFile  
Return the current page that must be printed.
Page  
Return or set the kind of paper used for printing.
Paper  
Return or set the custom paper height in millimeters.
PaperHeight  
Return or set the custom paper width in millimeters.
PaperWidth  
Return or set the printer resolution, in DPI (Dots Per Inches).
Resolution  
Return or set if the document pages will be printed in reverse order.
ReverseOrder  
Abort the current printing job.
Cancel  
Open the printer configuration dialog.
Configure  
Run the printing process.
Print  
This event is raised when the print starts.
Begin  
This event is raised for each page that must be printed.
Draw  
This event is raised when the print is finished.
End  
This event is raised so that you can paginate your document in the background.
Paginate  

Printing a document

To print a document:

  • Instanciate a Printer object.

  • Call the Configure method. A printing configuration dialog is displayed.

  • Call the Print method to run the printing process.

  • The Begin event is raised when the print starts. You should define the number of pages to print inside the Begin event handler, by setting the Count property.

  • If you don't define the Count property during the Begin event handler, the Paginate event will be raised again and again until that property is finally defined.

  • The Draw event is raised for each page that must be printed.

  • The End event is raised when the print terminates.

Paint.Begin is automatically called just before the Begin event, and Paint.End just after the End event.

You don't have to call them "by hand".

See also