Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Components
gb
gb.args
gb.cairo
gb.chart
gb.clipper
gb.complex
gb.compress
gb.crypt
gb.data
gb.db
gb.db.form
gb.db.mysql
gb.db.odbc
gb.db.postgresql
gb.db.sqlite2
gb.db.sqlite3
gb.dbus
gb.dbus.trayicon
gb.debug
gb.desktop
gb.desktop.gnome.keyring
gb.desktop.x11
gb.eval
gb.eval.highlight
gb.form
gb.form.dialog
gb.form.editor
gb.form.htmlview
gb.form.mdi
gb.form.print
gb.form.stock
gb.form.terminal
gb.gmp
gb.gsl
gb.gtk
gb.gtk.opengl
gb.gtk3
gb.gtk3.opengl
gb.gtk3.webview
gb.gui
gb.gui.opengl
gb.gui.qt
gb.gui.qt.opengl
gb.gui.qt.webkit
gb.gui.trayicon
gb.gui.webview
gb.hash
gb.highlight
gb.image
gb.image.effect
gb.image.imlib
gb.image.io
gb.inotify
gb.jit
gb.libxml
gb.logging
gb.map
gb.markdown
gb.media
gb.media.form
gb.memcached
gb.mime
gb.mysql
gb.ncurses
gb.net
gb.net.curl
gb.net.pop3
gb.net.smtp
gb.openal
gb.opengl
gb.opengl.glsl
gb.opengl.glu
gb.opengl.sge
gb.openssl
gb.option
gb.pcre
gb.pdf
gb.poppler
gb.qt4
.combobox.item
.container.children
.Menu.Children
.TabStripContainer
.TabStripContainer.Children
.TextArea.Selection
.TextBox.Selection
.Window.Controls
.Window.Menus
_ColumnView_Columns
_ComboBox_Item
_ComboBox_Selection
_Draw_Clip
_Draw_Style
_GridView_Cell
_GridView_Column
_GridView_Columns
_GridView_Data
_GridView_Row
_GridView_Rows
_IconView_Item
_ListBox_Item
_split
_TreeView
_TreeView_Item
Action
Align
Animation
Application
Arrange
Border
Button
CheckBox
Clipboard
Color
ColumnView
ComboBox
Container
ContainerChildren
Control
Cursor
Desktop
Dialog
Direction
Drag
Draw
DrawingArea
embedder
Fill
Font
Fonts
Form
Frame
GridView
HBox
HPanel
HSplit
IconView
Image
Key
Label
Line
ListBox
ListView
Menu
Message
Mouse
MovieBox
Paint
PaintBrush
PaintExtents
PaintMatrix
Panel
Picture
PictureBox
Point
Pointer
PointF
Printer
_new
A3
A4
A5
B5
Begin
Cancel
CollateCopies
Configure
CopyCount
Count
Custom
Default
Draw
Duplex
End
Executive
FirstPage
FullPage
GrayScale
Horizontal
Landscape
LastPage
Legal
Letter
List
Name
NumCopies
Orientation
OutputFile
Page
Paginate
Paper
PaperHeight
PaperWidth
Portrait
Print
Resolution
ReverseOrder
Simplex
Vertical
ProgressBar
RadioButton
Rect
RectF
Screen
Screens
Scroll
ScrollArea
ScrollBar
ScrollView
Select
Separator
Slider
SpinBox
Splitter
Spring
Style
SvgImage
TabStrip
TextArea
TextBox
TextLabel
ToggleButton
ToolButton
trayicon
trayicons
TreeView
UserContainer
UserControl
VBox
VPanel
VSplit
Watcher
Window
Windows
gb.qt4.ext
gb.qt4.opengl
gb.qt4.webkit
gb.qt4.webview
gb.qt5
gb.qt5.ext
gb.qt5.opengl
gb.qt5.webkit
gb.qt5.webview
gb.report
gb.report2
gb.scanner
gb.sdl
gb.sdl.sound
gb.sdl2
gb.sdl2.audio
gb.settings
gb.signal
gb.term
gb.test
gb.util
gb.util.web
gb.v4l
gb.vb
gb.web
gb.web.feed
gb.web.form
gb.web.gui
gb.xml
gb.xml.html
gb.xml.rpc
gb.xml.xslt
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Documents
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Last Changes
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

Printer (gb.qt4)

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

This class is creatable.

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

Static properties
Default   Return the name of the default printer.
List   Return the list of printers.

Properties
CollateCopies   Return or set if multiple copies are collated or not.
CopyCount   Return or set the number of copies that will be printed.
Count   Return or define the number of pages in the printed document.
Duplex   Return or set the printing duplex mode.
FirstPage   Return or set the first page that must be printed.
FullPage   Return or set if drawing page will be done inside the margins (FullPage is FALSE), or on the entire page (FullPage is TRUE).
GrayScale   Return or set if printing is done by using gray scale, or full colors.
LastPage   Return or set the last page that must be printed.
Name   Return or set the printer name.
NumCopies   Return or set the number of copies that will be printed.
Orientation   Return or set the printing orientation.
OutputFile   Return or set the path of the PDF or PostScript output file.
Page   Return the current page that must be printed.
Paper   Return or set the kind of paper used for printing.
PaperHeight   Return or set the custom paper height in millimeters.
PaperWidth   Return or set the custom paper width in millimeters.
Resolution   Return or set the printer resolution, in DPI (Dots Per Inches).
ReverseOrder   Return or set if the document pages will be printed in reverse order.

Methods
Cancel   Abort the current printing job.
Configure   Open the printer configuration dialog.
Print   Run the printing process.

Events
Begin   This event is raised when the print starts.
Draw   This event is raised for each page that must be printed.
End   This event is raised when the print is finished.
Paginate   This event is raised so that you can paginate your document in the background.

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