1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QPrinter Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPrinter Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPrinter class is a paint device that paints on a printer. <a href="#details">More...</a></p>
<p>Inherits <a href="qpaintdevice.html">QPaintDevice</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qprinter.html#ColorMode-enum">ColorMode</a></b> { GrayScale, Color }</li><li><div class="fn" />enum <b><a href="qprinter.html#DuplexMode-enum">DuplexMode</a></b> { DuplexNone, DuplexAuto, DuplexLongSide, DuplexShortSide }</li><li><div class="fn" />enum <b><a href="qprinter.html#Orientation-enum">Orientation</a></b> { Portrait, Landscape }</li><li><div class="fn" />enum <b><a href="qprinter.html#OutputFormat-enum">OutputFormat</a></b> { NativeFormat, PdfFormat, PostScriptFormat }</li><li><div class="fn" />enum <b><a href="qprinter.html#PageOrder-enum">PageOrder</a></b> { FirstPageFirst, LastPageFirst }</li><li><div class="fn" />enum <b><a href="qprinter.html#PageSize-enum">PageSize</a></b> { A4, B5, Letter, Legal, ..., Custom }</li><li><div class="fn" />enum <b><a href="qprinter.html#PaperSource-enum">PaperSource</a></b> { OnlyOne, Lower, Middle, Manual, ..., MaxPageSource }</li><li><div class="fn" />enum <b><a href="qprinter.html#PrinterMode-enum">PrinterMode</a></b> { ScreenResolution, PrinterResolution, HighResolution }</li><li><div class="fn" />enum <b><a href="qprinter.html#PrinterState-enum">PrinterState</a></b> { Idle, Active, Aborted, Error }</li><li><div class="fn" />enum <b><a href="qprinter.html#PrintRange-enum">PrintRange</a></b> { AllPages, Selection, PageRange }</li><li><div class="fn" />enum <b><a href="qprinter.html#Unit-enum">Unit</a></b> { Millimeter, Point, Inch, Pica, ..., DevicePixel }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qprinter.html#QPrinter">__init__</a></b> (<i>self</i>, PrinterMode <i>mode</i> = QPrinter.ScreenResolution)</li><li><div class="fn" /><b><a href="qprinter.html#QPrinter-2">__init__</a></b> (<i>self</i>, QPrinterInfo, PrinterMode <i>mode</i> = QPrinter.ScreenResolution)</li><li><div class="fn" />bool <b><a href="qprinter.html#abort">abort</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qprinter.html#actualNumCopies">actualNumCopies</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qprinter.html#collateCopies">collateCopies</a></b> (<i>self</i>)</li><li><div class="fn" />ColorMode <b><a href="qprinter.html#colorMode">colorMode</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qprinter.html#creator">creator</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qprinter.html#devType">devType</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qprinter.html#docName">docName</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qprinter.html#doubleSidedPrinting">doubleSidedPrinting</a></b> (<i>self</i>)</li><li><div class="fn" />DuplexMode <b><a href="qprinter.html#duplex">duplex</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qprinter.html#fontEmbeddingEnabled">fontEmbeddingEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qprinter.html#fromPage">fromPage</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qprinter.html#fullPage">fullPage</a></b> (<i>self</i>)</li><li><div class="fn" />(float, float, float, float) <b><a href="qprinter.html#getPageMargins">getPageMargins</a></b> (<i>self</i>, Unit)</li><li><div class="fn" />bool <b><a href="qprinter.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qprinter.html#metric">metric</a></b> (<i>self</i>, QPaintDevice.PaintDeviceMetric)</li><li><div class="fn" />bool <b><a href="qprinter.html#newPage">newPage</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qprinter.html#numCopies">numCopies</a></b> (<i>self</i>)</li><li><div class="fn" />Orientation <b><a href="qprinter.html#orientation">orientation</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qprinter.html#outputFileName">outputFileName</a></b> (<i>self</i>)</li><li><div class="fn" />OutputFormat <b><a href="qprinter.html#outputFormat">outputFormat</a></b> (<i>self</i>)</li><li><div class="fn" />PageOrder <b><a href="qprinter.html#pageOrder">pageOrder</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qprinter.html#pageRect">pageRect</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qprinter.html#pageRect-2">pageRect</a></b> (<i>self</i>, Unit)</li><li><div class="fn" />PageSize <b><a href="qprinter.html#pageSize">pageSize</a></b> (<i>self</i>)</li><li><div class="fn" />QPaintEngine <b><a href="qprinter.html#paintEngine">paintEngine</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qprinter.html#paperRect">paperRect</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qprinter.html#paperRect-2">paperRect</a></b> (<i>self</i>, Unit)</li><li><div class="fn" />PageSize <b><a href="qprinter.html#paperSize">paperSize</a></b> (<i>self</i>)</li><li><div class="fn" />QSizeF <b><a href="qprinter.html#paperSize-2">paperSize</a></b> (<i>self</i>, Unit)</li><li><div class="fn" />PaperSource <b><a href="qprinter.html#paperSource">paperSource</a></b> (<i>self</i>)</li><li><div class="fn" />QPrintEngine <b><a href="qprinter.html#printEngine">printEngine</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qprinter.html#printerName">printerName</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qprinter.html#printerSelectionOption">printerSelectionOption</a></b> (<i>self</i>)</li><li><div class="fn" />PrinterState <b><a href="qprinter.html#printerState">printerState</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qprinter.html#printProgram">printProgram</a></b> (<i>self</i>)</li><li><div class="fn" />PrintRange <b><a href="qprinter.html#printRange">printRange</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qprinter.html#resolution">resolution</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprinter.html#setCollateCopies">setCollateCopies</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qprinter.html#setColorMode">setColorMode</a></b> (<i>self</i>, ColorMode)</li><li><div class="fn" /><b><a href="qprinter.html#setCreator">setCreator</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qprinter.html#setDocName">setDocName</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qprinter.html#setDoubleSidedPrinting">setDoubleSidedPrinting</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qprinter.html#setDuplex">setDuplex</a></b> (<i>self</i>, DuplexMode)</li><li><div class="fn" /><b><a href="qprinter.html#setEngines">setEngines</a></b> (<i>self</i>, QPrintEngine, QPaintEngine)</li><li><div class="fn" /><b><a href="qprinter.html#setFontEmbeddingEnabled">setFontEmbeddingEnabled</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qprinter.html#setFromTo">setFromTo</a></b> (<i>self</i>, int, int)</li><li><div class="fn" /><b><a href="qprinter.html#setFullPage">setFullPage</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qprinter.html#setNumCopies">setNumCopies</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qprinter.html#setOrientation">setOrientation</a></b> (<i>self</i>, Orientation)</li><li><div class="fn" /><b><a href="qprinter.html#setOutputFileName">setOutputFileName</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qprinter.html#setOutputFormat">setOutputFormat</a></b> (<i>self</i>, OutputFormat)</li><li><div class="fn" /><b><a href="qprinter.html#setPageMargins">setPageMargins</a></b> (<i>self</i>, float, float, float, float, Unit)</li><li><div class="fn" /><b><a href="qprinter.html#setPageOrder">setPageOrder</a></b> (<i>self</i>, PageOrder)</li><li><div class="fn" /><b><a href="qprinter.html#setPageSize">setPageSize</a></b> (<i>self</i>, PageSize)</li><li><div class="fn" /><b><a href="qprinter.html#setPaperSize">setPaperSize</a></b> (<i>self</i>, PageSize)</li><li><div class="fn" /><b><a href="qprinter.html#setPaperSize-2">setPaperSize</a></b> (<i>self</i>, QSizeF, Unit)</li><li><div class="fn" /><b><a href="qprinter.html#setPaperSource">setPaperSource</a></b> (<i>self</i>, PaperSource)</li><li><div class="fn" /><b><a href="qprinter.html#setPrinterName">setPrinterName</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qprinter.html#setPrinterSelectionOption">setPrinterSelectionOption</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qprinter.html#setPrintProgram">setPrintProgram</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qprinter.html#setPrintRange">setPrintRange</a></b> (<i>self</i>, PrintRange)</li><li><div class="fn" /><b><a href="qprinter.html#setResolution">setResolution</a></b> (<i>self</i>, int)</li><li><div class="fn" />list-of-int <b><a href="qprinter.html#supportedResolutions">supportedResolutions</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qprinter.html#toPage">toPage</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPrinter class is a paint device that paints on a printer.</p>
<p>This device represents a series of pages of printed output, and is used in almost exactly the same way as other paint devices such as <a href="qwidget.html">QWidget</a> and <a href="qpixmap.html">QPixmap</a>. A set of additional functions are provided to manage device-specific features, such as orientation and resolution, and to step through the pages in a document as it is generated.</p>
<p>When printing directly to a printer on Windows or Mac OS X, QPrinter uses the built-in printer drivers. On X11, QPrinter uses the <a href="http://www.cups.org/">Common Unix Printing System (CUPS)</a> or the standard Unix <a href="http://www.ietf.org/rfc/rfc1179.txt#lpr">lpr</a> utility to send PostScript or PDF output to the printer. As an alternative, the <a href="qprinter.html#printProgram">printProgram</a>() function can be used to specify the command or utility to use instead of the system default.</p>
<p>Note that setting parameters like paper size and resolution on an invalid printer is undefined. You can use <a href="qprinter.html#isValid">QPrinter.isValid</a>() to verify this before changing any parameters.</p>
<p>QPrinter supports a number of parameters, most of which can be changed by the end user through a <a href="qprintdialog.html">print dialog</a>. In general, QPrinter passes these functions onto the underlying <a href="qprintengine.html">QPrintEngine</a>.</p>
<p>The most important parameters are:</p>
<ul>
<li><a href="qprinter.html#setOrientation">setOrientation</a>() tells QPrinter which page orientation to use.</li>
<li><a href="qprinter.html#setPaperSize">setPaperSize</a>() tells QPrinter what paper size to expect from the printer.</li>
<li><a href="qprinter.html#setResolution">setResolution</a>() tells QPrinter what resolution you wish the printer to provide, in dots per inch (DPI).</li>
<li><a href="qprinter.html#setFullPage">setFullPage</a>() tells QPrinter whether you want to deal with the full page or just with the part the printer can draw on.</li>
<li><a href="qprinter.html#setNumCopies">setNumCopies</a>() tells QPrinter how many copies of the document it should print.</li>
</ul>
<p>Many of these functions can only be called before the actual printing begins (i.e., before <a href="qpainter.html#begin">QPainter.begin</a>() is called). This usually makes sense because, for example, it's not possible to change the number of copies when you are halfway through printing. There are also some settings that the user sets (through the printer dialog) and that applications are expected to obey. See <a href="qabstractprintdialog.html">QAbstractPrintDialog</a>'s documentation for more details.</p>
<p>When <a href="qpainter.html#begin">QPainter.begin</a>() is called, the QPrinter it operates on is prepared for a new page, enabling the <a href="qpainter.html">QPainter</a> to be used immediately to paint the first page in a document. Once the first page has been painted, <a href="qprinter.html#newPage">newPage</a>() can be called to request a new blank page to paint on, or <a href="qpainter.html#end">QPainter.end</a>() can be called to finish printing. The second page and all following pages are prepared using a call to <a href="qprinter.html#newPage">newPage</a>() before they are painted.</p>
<p>The first page in a document does not need to be preceded by a call to <a href="qprinter.html#newPage">newPage</a>(). You only need to calling <a href="qprinter.html#newPage">newPage</a>() after <a href="qpainter.html#begin">QPainter.begin</a>() if you need to insert a blank page at the beginning of a printed document. Similarly, calling <a href="qprinter.html#newPage">newPage</a>() after the last page in a document is painted will result in a trailing blank page appended to the end of the printed document.</p>
<p>If you want to abort the print job, <a href="qprinter.html#abort">abort</a>() will try its best to stop printing. It may cancel the entire job or just part of it.</p>
<p>Since QPrinter can print to any <a href="qprintengine.html">QPrintEngine</a> subclass, it is possible to extend printing support to cover new types of printing subsystem by subclassing <a href="qprintengine.html">QPrintEngine</a> and reimplementing its interface.</p>
<p>See also <a href="qprintdialog.html">QPrintDialog</a> and <a href="printing.html">Printing with Qt</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ColorMode-enum" />QPrinter.ColorMode</h3><p>This enum type is used to indicate whether <a href="qprinter.html">QPrinter</a> should print in color or not.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QPrinter.Color</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">print in color if available, otherwise in grayscale.</td></tr>
<tr><td valign="top"><tt>QPrinter.GrayScale</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">print in grayscale, even on color printers.</td></tr>
</table></p>
<a name="//apple_ref/cpp/tag/QPrinter/DuplexMode" />
<a name="//apple_ref/cpp/econst/QPrinter/DuplexNone" />
<a name="//apple_ref/cpp/econst/QPrinter/DuplexAuto" />
<a name="//apple_ref/cpp/econst/QPrinter/DuplexLongSide" />
<a name="//apple_ref/cpp/econst/QPrinter/DuplexShortSide" />
<h3 class="fn"><a name="DuplexMode-enum" />QPrinter.DuplexMode</h3><p>This enum is used to indicate whether printing will occur on one or both sides of each sheet of paper (simplex or duplex printing).</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QPrinter.DuplexNone</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">Single sided (simplex) printing only.</td></tr>
<tr><td valign="top"><tt>QPrinter.DuplexAuto</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The printer's default setting is used to determine whether duplex printing is used.</td></tr>
<tr><td valign="top"><tt>QPrinter.DuplexLongSide</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">Both sides of each sheet of paper are used for printing. The paper is turned over its longest edge before the second side is printed</td></tr>
<tr><td valign="top"><tt>QPrinter.DuplexShortSide</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">Both sides of each sheet of paper are used for printing. The paper is turned over its shortest edge before the second side is printed</td></tr>
</table></p>
<p>This enum was introduced in Qt 4.4.</p>
<a name="//apple_ref/cpp/tag/QPrinter/Orientation" />
<a name="//apple_ref/cpp/econst/QPrinter/Portrait" />
<a name="//apple_ref/cpp/econst/QPrinter/Landscape" />
<h3 class="fn"><a name="Orientation-enum" />QPrinter.Orientation</h3><p>This enum type (not to be confused with <tt>Orientation</tt>) is used to specify each page's orientation.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QPrinter.Portrait</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">the page's height is greater than its width.</td></tr>
<tr><td valign="top"><tt>QPrinter.Landscape</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">the page's width is greater than its height.</td></tr>
</table></p>
<p>This type interacts with <a href="qprinter.html#PaperSize-enum">QPrinter.PaperSize</a> and <a href="qprinter.html#setFullPage">QPrinter.setFullPage</a>() to determine the final size of the page available to the application.</p>
<a name="//apple_ref/cpp/tag/QPrinter/OutputFormat" />
<a name="//apple_ref/cpp/econst/QPrinter/NativeFormat" />
<a name="//apple_ref/cpp/econst/QPrinter/PdfFormat" />
<a name="//apple_ref/cpp/econst/QPrinter/PostScriptFormat" />
<h3 class="fn"><a name="OutputFormat-enum" />QPrinter.OutputFormat</h3><p>The OutputFormat enum is used to describe the format <a href="qprinter.html">QPrinter</a> should use for printing.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QPrinter.NativeFormat</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top"><a href="qprinter.html">QPrinter</a> will print output using a method defined by the platform it is running on. This mode is the default when printing directly to a printer.</td></tr>
<tr><td valign="top"><tt>QPrinter.PdfFormat</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top"><a href="qprinter.html">QPrinter</a> will generate its output as a searchable PDF file. This mode is the default when printing to a file.</td></tr>
<tr><td valign="top"><tt>QPrinter.PostScriptFormat</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top"><a href="qprinter.html">QPrinter</a> will generate its output as in the PostScript format. (This feature was introduced in Qt 4.2.)</td></tr>
</table></p>
<p>See also <a href="qprinter.html#outputFormat">outputFormat</a>(), <a href="qprinter.html#setOutputFormat">setOutputFormat</a>(), and <a href="qprinter.html#setOutputFileName">setOutputFileName</a>().</p>
<a name="//apple_ref/cpp/tag/QPrinter/PageOrder" />
<a name="//apple_ref/cpp/econst/QPrinter/FirstPageFirst" />
<a name="//apple_ref/cpp/econst/QPrinter/LastPageFirst" />
<h3 class="fn"><a name="PageOrder-enum" />QPrinter.PageOrder</h3><p>This enum type is used by <a href="qprinter.html">QPrinter</a> to tell the application program how to print.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QPrinter.FirstPageFirst</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">the lowest-numbered page should be printed first.</td></tr>
<tr><td valign="top"><tt>QPrinter.LastPageFirst</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">the highest-numbered page should be printed first.</td></tr>
</table></p>
<a name="//apple_ref/cpp/tag/QPrinter/PaperSize" />
<a name="//apple_ref/cpp/econst/QPrinter/A0" />
<a name="//apple_ref/cpp/econst/QPrinter/A1" />
<a name="//apple_ref/cpp/econst/QPrinter/A2" />
<a name="//apple_ref/cpp/econst/QPrinter/A3" />
<a name="//apple_ref/cpp/econst/QPrinter/A4" />
<a name="//apple_ref/cpp/econst/QPrinter/A5" />
<a name="//apple_ref/cpp/econst/QPrinter/A6" />
<a name="//apple_ref/cpp/econst/QPrinter/A7" />
<a name="//apple_ref/cpp/econst/QPrinter/A8" />
<a name="//apple_ref/cpp/econst/QPrinter/A9" />
<a name="//apple_ref/cpp/econst/QPrinter/B0" />
<a name="//apple_ref/cpp/econst/QPrinter/B1" />
<a name="//apple_ref/cpp/econst/QPrinter/B2" />
<a name="//apple_ref/cpp/econst/QPrinter/B3" />
<a name="//apple_ref/cpp/econst/QPrinter/B4" />
<a name="//apple_ref/cpp/econst/QPrinter/B5" />
<a name="//apple_ref/cpp/econst/QPrinter/B6" />
<a name="//apple_ref/cpp/econst/QPrinter/B7" />
<a name="//apple_ref/cpp/econst/QPrinter/B8" />
<a name="//apple_ref/cpp/econst/QPrinter/B9" />
<a name="//apple_ref/cpp/econst/QPrinter/B10" />
<a name="//apple_ref/cpp/econst/QPrinter/C5E" />
<a name="//apple_ref/cpp/econst/QPrinter/Comm10E" />
<a name="//apple_ref/cpp/econst/QPrinter/DLE" />
<a name="//apple_ref/cpp/econst/QPrinter/Executive" />
<a name="//apple_ref/cpp/econst/QPrinter/Folio" />
<a name="//apple_ref/cpp/econst/QPrinter/Ledger" />
<a name="//apple_ref/cpp/econst/QPrinter/Legal" />
<a name="//apple_ref/cpp/econst/QPrinter/Letter" />
<a name="//apple_ref/cpp/econst/QPrinter/Tabloid" />
<a name="//apple_ref/cpp/econst/QPrinter/Custom" />
<a name="//apple_ref/cpp/econst/QPrinter/NPageSize" />
<a name="//apple_ref/cpp/econst/QPrinter/NPaperSize" />
<h3 class="fn"><a name="PageSize-enum" />QPrinter.PageSize</h3><h3 class="fn"><a name="PaperSource-enum" />QPrinter.PaperSource</h3><p>This enum type specifies what paper source <a href="qprinter.html">QPrinter</a> is to use. <a href="qprinter.html">QPrinter</a> does not check that the paper source is available; it just uses this information to try and set the paper source. Whether it will set the paper source depends on whether the printer has that particular source.</p>
<p><b>Warning:</b> This is currently only implemented for Windows.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="40%">
<tr><th width="60%">Constant</th><th width="40%">Value</th></tr>
<tr><td valign="top"><tt>QPrinter.Auto</tt></td><td align="center" valign="top"><tt>6</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Cassette</tt></td><td align="center" valign="top"><tt>11</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Envelope</tt></td><td align="center" valign="top"><tt>4</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.EnvelopeManual</tt></td><td align="center" valign="top"><tt>5</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.FormSource</tt></td><td align="center" valign="top"><tt>12</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.LargeCapacity</tt></td><td align="center" valign="top"><tt>10</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.LargeFormat</tt></td><td align="center" valign="top"><tt>9</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Lower</tt></td><td align="center" valign="top"><tt>1</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.MaxPageSource</tt></td><td align="center" valign="top"><tt>13</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Middle</tt></td><td align="center" valign="top"><tt>2</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Manual</tt></td><td align="center" valign="top"><tt>3</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.OnlyOne</tt></td><td align="center" valign="top"><tt>0</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Tractor</tt></td><td align="center" valign="top"><tt>7</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.SmallFormat</tt></td><td align="center" valign="top"><tt>8</tt></td></tr>
</table></p>
<a name="//apple_ref/cpp/tag/QPrinter/PrintRange" />
<a name="//apple_ref/cpp/econst/QPrinter/AllPages" />
<a name="//apple_ref/cpp/econst/QPrinter/Selection" />
<a name="//apple_ref/cpp/econst/QPrinter/PageRange" />
<h3 class="fn"><a name="PrinterMode-enum" />QPrinter.PrinterMode</h3><p>This enum describes the mode the printer should work in. It basically presets a certain resolution and working mode.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QPrinter.ScreenResolution</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">Sets the resolution of the print device to the screen resolution. This has the big advantage that the results obtained when painting on the printer will match more or less exactly the visible output on the screen. It is the easiest to use, as font metrics on the screen and on the printer are the same. This is the default value. ScreenResolution will produce a lower quality output than HighResolution and should only be used for drafts.</td></tr>
<tr><td valign="top"><tt>QPrinter.PrinterResolution</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">This value is deprecated. Is is equivalent to ScreenResolution on Unix and HighResolution on Windows and Mac. Due do the difference between ScreenResolution and HighResolution, use of this value may lead to non-portable printer code.</td></tr>
<tr><td valign="top"><tt>QPrinter.HighResolution</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">On Windows, sets the printer resolution to that defined for the printer in use. For PostScript printing, sets the resolution of the PostScript driver to 1200 dpi.</td></tr>
</table></p>
<p><b>Note:</b> When rendering text on a <a href="qprinter.html">QPrinter</a> device, it is important to realize that the size of text, when specified in points, is independent of the resolution specified for the device itself. Therefore, it may be useful to specify the font size in pixels when combining text with graphics to ensure that their relative sizes are what you expect.</p>
<a name="//apple_ref/cpp/tag/QPrinter/PrinterState" />
<a name="//apple_ref/cpp/econst/QPrinter/Idle" />
<a name="//apple_ref/cpp/econst/QPrinter/Active" />
<a name="//apple_ref/cpp/econst/QPrinter/Aborted" />
<a name="//apple_ref/cpp/econst/QPrinter/Error" />
<h3 class="fn"><a name="PrinterState-enum" />QPrinter.PrinterState</h3><p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="40%">
<tr><th width="60%">Constant</th><th width="40%">Value</th></tr>
<tr><td valign="top"><tt>QPrinter.Idle</tt></td><td align="center" valign="top"><tt>0</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Active</tt></td><td align="center" valign="top"><tt>1</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Aborted</tt></td><td align="center" valign="top"><tt>2</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Error</tt></td><td align="center" valign="top"><tt>3</tt></td></tr>
</table></p>
<a name="//apple_ref/cpp/tag/QPrinter/Unit" />
<a name="//apple_ref/cpp/econst/QPrinter/Millimeter" />
<a name="//apple_ref/cpp/econst/QPrinter/Point" />
<a name="//apple_ref/cpp/econst/QPrinter/Inch" />
<a name="//apple_ref/cpp/econst/QPrinter/Pica" />
<a name="//apple_ref/cpp/econst/QPrinter/Didot" />
<a name="//apple_ref/cpp/econst/QPrinter/Cicero" />
<a name="//apple_ref/cpp/econst/QPrinter/DevicePixel" />
<h3 class="fn"><a name="PrintRange-enum" />QPrinter.PrintRange</h3><p>Used to specify the print range selection option.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QPrinter.AllPages</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">All pages should be printed.</td></tr>
<tr><td valign="top"><tt>QPrinter.Selection</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">Only the selection should be printed.</td></tr>
<tr><td valign="top"><tt>QPrinter.PageRange</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The specified page range should be printed.</td></tr>
</table></p>
<p>See also <a href="qabstractprintdialog.html#PrintRange-enum">QAbstractPrintDialog.PrintRange</a>.</p>
<a name="//apple_ref/cpp/tag/QPrinter/PrinterMode" />
<a name="//apple_ref/cpp/econst/QPrinter/ScreenResolution" />
<a name="//apple_ref/cpp/econst/QPrinter/PrinterResolution" />
<a name="//apple_ref/cpp/econst/QPrinter/HighResolution" />
<h3 class="fn"><a name="Unit-enum" />QPrinter.Unit</h3><p>This enum type is used to specify the measurement unit for page and paper sizes.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="40%">
<tr><th width="60%">Constant</th><th width="40%">Value</th></tr>
<tr><td valign="top"><tt>QPrinter.Millimeter</tt></td><td align="center" valign="top"><tt>0</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Point</tt></td><td align="center" valign="top"><tt>1</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Inch</tt></td><td align="center" valign="top"><tt>2</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Pica</tt></td><td align="center" valign="top"><tt>3</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Didot</tt></td><td align="center" valign="top"><tt>4</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.Cicero</tt></td><td align="center" valign="top"><tt>5</tt></td></tr>
<tr><td valign="top"><tt>QPrinter.DevicePixel</tt></td><td align="center" valign="top"><tt>6</tt></td></tr>
</table></p>
<p>Note the difference between Point and DevicePixel. The Point unit is defined to be 1/72th of an inch, while the DevicePixel unit is resolution dependant and is based on the actual pixels, or dots, on the printer.</p>
<p>This enum was introduced in Qt 4.4.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPrinter" />QPrinter.__init__ (<i>self</i>, <a href="qprinter.html#PrinterMode-enum">PrinterMode</a> <i>mode</i> = QPrinter.ScreenResolution)</h3><p>Creates a new printer object with the given <i>mode</i>.</p>
<h3 class="fn"><a name="QPrinter-2" />QPrinter.__init__ (<i>self</i>, <a href="qprinterinfo.html">QPrinterInfo</a>, <a href="qprinter.html#PrinterMode-enum">PrinterMode</a> <i>mode</i> = QPrinter.ScreenResolution)</h3><p>Creates a new printer object with the given <i>printer</i> and <i>mode</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<a name="//apple_ref/cpp/instm/QPrinter/~QPrinter" />
<h3 class="fn"><a name="abort" />bool QPrinter.abort (<i>self</i>)</h3><p>Aborts the current print run. Returns true if the print run was successfully aborted and <a href="qprinter.html#printerState">printerState</a>() will return <a href="qprinter.html#PrinterState-enum">QPrinter.Aborted</a>; otherwise returns false.</p>
<p>It is not always possible to abort a print job. For example, all the data has gone to the printer but the printer cannot or will not cancel the job when asked to.</p>
<a name="//apple_ref/cpp/instm/QPrinter/actualNumCopies" />
<h3 class="fn"><a name="actualNumCopies" />int QPrinter.actualNumCopies (<i>self</i>)</h3><p>Returns the number of copies that will be printed. The default value is 1.</p>
<p>This function always returns the actual value specified in the print dialog or using <a href="qprinter.html#setNumCopies">setNumCopies</a>().</p>
<p>This function was introduced in Qt 4.6.</p>
<p>See also <a href="qprinter.html#setNumCopies">setNumCopies</a>() and <a href="qprinter.html#numCopies">numCopies</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/collateCopies" />
<h3 class="fn"><a name="collateCopies" />bool QPrinter.collateCopies (<i>self</i>)</h3><p>Returns true if collation is turned on when multiple copies is selected. Returns false if it is turned off when multiple copies is selected. When collating is turned off the printing of each individual page will be repeated the <a href="qprinter.html#numCopies">numCopies</a>() amount before the next page is started. With collating turned on all pages are printed before the next copy of those pages is started.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qprinter.html#setCollateCopies">setCollateCopies</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/colorMode" />
<h3 class="fn"><a name="colorMode" /><a href="qprinter.html#ColorMode-enum">ColorMode</a> QPrinter.colorMode (<i>self</i>)</h3><p>Returns the current color mode.</p>
<p>See also <a href="qprinter.html#setColorMode">setColorMode</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/creator" />
<h3 class="fn"><a name="creator" />QString QPrinter.creator (<i>self</i>)</h3><p>Returns the name of the application that created the document.</p>
<p>See also <a href="qprinter.html#setCreator">setCreator</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/docName" />
<h3 class="fn"><a name="devType" />int QPrinter.devType (<i>self</i>)</h3><h3 class="fn"><a name="docName" />QString QPrinter.docName (<i>self</i>)</h3><p>Returns the document name.</p>
<p>See also <a href="qprinter.html#setDocName">setDocName</a>() and <a href="qprintengine.html#PrintEnginePropertyKey-enum">QPrintEngine.PrintEnginePropertyKey</a>.</p>
<a name="//apple_ref/cpp/instm/QPrinter/doubleSidedPrinting" />
<h3 class="fn"><a name="doubleSidedPrinting" />bool QPrinter.doubleSidedPrinting (<i>self</i>)</h3><p>Returns true if double side printing is enabled.</p>
<p>Currently this option is only supported on X11.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qprinter.html#setDoubleSidedPrinting">setDoubleSidedPrinting</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/duplex" />
<h3 class="fn"><a name="duplex" /><a href="qprinter.html#DuplexMode-enum">DuplexMode</a> QPrinter.duplex (<i>self</i>)</h3><p>Returns the current duplex mode.</p>
<p>Currently this option is only supported on X11.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qprinter.html#setDuplex">setDuplex</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/fontEmbeddingEnabled" />
<h3 class="fn"><a name="fontEmbeddingEnabled" />bool QPrinter.fontEmbeddingEnabled (<i>self</i>)</h3><p>Returns true if font embedding is enabled.</p>
<p>Currently this option is only supported on X11.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qprinter.html#setFontEmbeddingEnabled">setFontEmbeddingEnabled</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/fromPage" />
<h3 class="fn"><a name="fromPage" />int QPrinter.fromPage (<i>self</i>)</h3><p>Returns the number of the first page in a range of pages to be printed (the "from page" setting). Pages in a document are numbered according to the convention that the first page is page 1.</p>
<p>By default, this function returns a special value of 0, meaning that the "from page" setting is unset.</p>
<p><b>Note:</b> If fromPage() and <a href="qprinter.html#toPage">toPage</a>() both return 0, this indicates that <i>the whole document will be printed</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qprinter.html#setFromTo">setFromTo</a>() and <a href="qprinter.html#toPage">toPage</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/fullPage" />
<h3 class="fn"><a name="fullPage" />bool QPrinter.fullPage (<i>self</i>)</h3><p>Returns true if the origin of the printer's coordinate system is at the corner of the page and false if it is at the edge of the printable area.</p>
<p>See <a href="qprinter.html#setFullPage">setFullPage</a>() for details and caveats.</p>
<p>See also <a href="qprinter.html#setFullPage">setFullPage</a>() and <a href="qprinter.html#PaperSize-enum">PaperSize</a>.</p>
<a name="//apple_ref/cpp/instm/QPrinter/getPageMargins" />
<h3 class="fn"><a name="getPageMargins" />(float, float, float, float) QPrinter.getPageMargins (<i>self</i>, <a href="qprinter.html#Unit-enum">Unit</a>)</h3><p>Returns the page margins for this printer in <i>left</i>, <i>top</i>, <i>right</i>, <i>bottom</i>. The unit of the returned margins are specified with the <i>unit</i> parameter.</p>
<p>This function was introduced in Qt 4.4.</p>
<a name="//apple_ref/cpp/instm/QPrinter/isValid" />
<h3 class="fn"><a name="isValid" />bool QPrinter.isValid (<i>self</i>)</h3><p>Returns true if the printer currently selected is a valid printer in the system, or a pure PDF/PostScript printer; otherwise returns false.</p>
<p>To detect other failures check the output of <a href="qpainter.html#begin">QPainter.begin</a>() or <a href="qprinter.html#newPage">QPrinter.newPage</a>().</p>
<pre> QPrinter printer;
printer.setOutputFormat(QPrinter.PdfFormat);
printer.setOutputFileName("/foobar/nonwritable.pdf");
QPainter painter;
if (! painter.begin(&printer)) { <span class="comment">// failed to open file</span>
qWarning("failed to open file, is it writable?");
return 1;
}
painter.drawText(10, 10, "Test");
if (! printer.newPage()) {
qWarning("failed in flushing page to disk, disk full?");
return 1;
}
painter.drawText(10, 10, "Test 2");
painter.end();</pre>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qprinter.html#setPrinterName">setPrinterName</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/newPage" />
<h3 class="fn"><a name="metric" />int QPrinter.metric (<i>self</i>, <a href="qpaintdevice.html#PaintDeviceMetric-enum">QPaintDevice.PaintDeviceMetric</a>)</h3><h3 class="fn"><a name="newPage" />bool QPrinter.newPage (<i>self</i>)</h3><p>Tells the printer to eject the current page and to continue printing on a new page. Returns true if this was successful; otherwise returns false.</p>
<p>Calling newPage() on an inactive <a href="qprinter.html">QPrinter</a> object will always fail.</p>
<a name="//apple_ref/cpp/instm/QPrinter/numCopies" />
<h3 class="fn"><a name="numCopies" />int QPrinter.numCopies (<i>self</i>)</h3><p>Returns the number of copies to be printed. The default value is 1.</p>
<p>On Windows, Mac OS X and X11 systems that support CUPS, this will always return 1 as these operating systems can internally handle the number of copies.</p>
<p>On X11, this value will return the number of times the application is required to print in order to match the number specified in the printer setup dialog. This has been done since some printer drivers are not capable of buffering up the copies and in those cases the application must make an explicit call to the print code for each copy.</p>
<p>See also <a href="qprinter.html#setNumCopies">setNumCopies</a>() and <a href="qprinter.html#actualNumCopies">actualNumCopies</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/orientation" />
<h3 class="fn"><a name="orientation" /><a href="qprinter.html#Orientation-enum">Orientation</a> QPrinter.orientation (<i>self</i>)</h3><p>Returns the orientation setting. This is driver-dependent, but is usually <a href="qprinter.html#Orientation-enum">QPrinter.Portrait</a>.</p>
<p>See also <a href="qprinter.html#setOrientation">setOrientation</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/outputFileName" />
<h3 class="fn"><a name="outputFileName" />QString QPrinter.outputFileName (<i>self</i>)</h3><p>Returns the name of the output file. By default, this is an empty string (indicating that the printer shouldn't print to file).</p>
<p>See also <a href="qprinter.html#setOutputFileName">setOutputFileName</a>() and <a href="qprintengine.html#PrintEnginePropertyKey-enum">QPrintEngine.PrintEnginePropertyKey</a>.</p>
<a name="//apple_ref/cpp/instm/QPrinter/outputFormat" />
<h3 class="fn"><a name="outputFormat" /><a href="qprinter.html#OutputFormat-enum">OutputFormat</a> QPrinter.outputFormat (<i>self</i>)</h3><p>Returns the output format for this printer.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qprinter.html#setOutputFormat">setOutputFormat</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/pageOrder" />
<h3 class="fn"><a name="pageOrder" /><a href="qprinter.html#PageOrder-enum">PageOrder</a> QPrinter.pageOrder (<i>self</i>)</h3><p>Returns the current page order.</p>
<p>The default page order is <tt>FirstPageFirst</tt>.</p>
<p>See also <a href="qprinter.html#setPageOrder">setPageOrder</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/pageRect" />
<h3 class="fn"><a name="pageRect" /><a href="qrect.html">QRect</a> QPrinter.pageRect (<i>self</i>)</h3><p>Returns the page's rectangle; this is usually smaller than the <a href="qprinter.html#paperRect">paperRect</a>() since the page normally has margins between its borders and the paper.</p>
<p>The unit of the returned rectangle is <a href="qprinter.html#Unit-enum">DevicePixel</a>.</p>
<p>See also <a href="qprinter.html#paperSize">paperSize</a>().</p>
<h3 class="fn"><a name="pageRect-2" /><a href="qrectf.html">QRectF</a> QPrinter.pageRect (<i>self</i>, <a href="qprinter.html#Unit-enum">Unit</a>)</h3><p>Returns the page's rectangle in <i>unit</i>; this is usually smaller than the <a href="qprinter.html#paperRect">paperRect</a>() since the page normally has margins between its borders and the paper.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qprinter.html#paperSize">paperSize</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/paintEngine" />
<h3 class="fn"><a name="pageSize" /><a href="qprinter.html#PageSize-enum">PageSize</a> QPrinter.pageSize (<i>self</i>)</h3><h3 class="fn"><a name="paintEngine" /><a href="qpaintengine.html">QPaintEngine</a> QPrinter.paintEngine (<i>self</i>)</h3><p>Reimplemented from <a href="qpaintdevice.html#paintEngine">QPaintDevice.paintEngine</a>().</p>
<p>Returns the paint engine used by the printer.</p>
<a name="//apple_ref/cpp/instm/QPrinter/paperRect" />
<h3 class="fn"><a name="paperRect" /><a href="qrect.html">QRect</a> QPrinter.paperRect (<i>self</i>)</h3><p>Returns the paper's rectangle; this is usually larger than the <a href="qprinter.html#pageRect">pageRect</a>().</p>
<p>The unit of the returned rectangle is <a href="qprinter.html#Unit-enum">DevicePixel</a>.</p>
<p>See also <a href="qprinter.html#pageRect">pageRect</a>().</p>
<h3 class="fn"><a name="paperRect-2" /><a href="qrectf.html">QRectF</a> QPrinter.paperRect (<i>self</i>, <a href="qprinter.html#Unit-enum">Unit</a>)</h3><p>Returns the paper's rectangle in <i>unit</i>; this is usually larger than the <a href="qprinter.html#pageRect">pageRect</a>().</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qprinter.html#pageRect">pageRect</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/paperSize" />
<h3 class="fn"><a name="paperSize" /><a href="qprinter.html#PageSize-enum">PageSize</a> QPrinter.paperSize (<i>self</i>)</h3><p>Returns the printer paper size. The default value is driver-dependent.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qprinter.html#setPaperSize">setPaperSize</a>(), <a href="qprinter.html#pageRect">pageRect</a>(), and <a href="qprinter.html#paperRect">paperRect</a>().</p>
<h3 class="fn"><a name="paperSize-2" /><a href="qsizef.html">QSizeF</a> QPrinter.paperSize (<i>self</i>, <a href="qprinter.html#Unit-enum">Unit</a>)</h3><p>Returns the paper size in <i>unit</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qprinter.html#setPaperSize">setPaperSize</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/paperSource" />
<h3 class="fn"><a name="paperSource" /><a href="qprinter.html#PaperSource-enum">PaperSource</a> QPrinter.paperSource (<i>self</i>)</h3><p>Returns the printer's paper source. This is <tt>Manual</tt> or a printer tray or paper cassette.</p>
<p>See also <a href="qprinter.html#setPaperSource">setPaperSource</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/printEngine" />
<h3 class="fn"><a name="printEngine" /><a href="qprintengine.html">QPrintEngine</a> QPrinter.printEngine (<i>self</i>)</h3><p>Returns the print engine used by the printer.</p>
<p>This function was introduced in Qt 4.1.</p>
<a name="//apple_ref/cpp/instm/QPrinter/printProgram" />
<h3 class="fn"><a name="printerName" />QString QPrinter.printerName (<i>self</i>)</h3><p>Returns the printer name. This value is initially set to the name of the default printer.</p>
<p>See also <a href="qprinter.html#setPrinterName">setPrinterName</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/printerSelectionOption" />
<h3 class="fn"><a name="printerSelectionOption" />QString QPrinter.printerSelectionOption (<i>self</i>)</h3><p>Returns the printer options selection string. This is useful only if the print command has been explicitly set.</p>
<p>The default value (an empty string) implies that the printer should be selected in a system-dependent manner.</p>
<p>Any other value implies that the given value should be used.</p>
<p><b>Warning:</b> This function is not available on Windows.</p>
<p>See also <a href="qprinter.html#setPrinterSelectionOption">setPrinterSelectionOption</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/printerState" />
<h3 class="fn"><a name="printerState" /><a href="qprinter.html#PrinterState-enum">PrinterState</a> QPrinter.printerState (<i>self</i>)</h3><p>Returns the current state of the printer. This may not always be accurate (for example if the printer doesn't have the capability of reporting its state to the operating system).</p>
<a name="//apple_ref/cpp/instm/QPrinter/resolution" />
<h3 class="fn"><a name="printProgram" />QString QPrinter.printProgram (<i>self</i>)</h3><p>Returns the name of the program that sends the print output to the printer.</p>
<p>The default is to return an empty string; meaning that <a href="qprinter.html">QPrinter</a> will try to be smart in a system-dependent way. On X11 only, you can set it to something different to use a specific print program. On the other platforms, this returns an empty string.</p>
<p>See also <a href="qprinter.html#setPrintProgram">setPrintProgram</a>() and <a href="qprinter.html#setPrinterSelectionOption">setPrinterSelectionOption</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/printRange" />
<h3 class="fn"><a name="printRange" /><a href="qprinter.html#PrintRange-enum">PrintRange</a> QPrinter.printRange (<i>self</i>)</h3><p>Returns the page range of the <a href="qprinter.html">QPrinter</a>. After the print setup dialog has been opened, this function returns the value selected by the user.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qprinter.html#setPrintRange">setPrintRange</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/printerName" />
<h3 class="fn"><a name="resolution" />int QPrinter.resolution (<i>self</i>)</h3><p>Returns the current assumed resolution of the printer, as set by <a href="qprinter.html#setResolution">setResolution</a>() or by the printer driver.</p>
<p>See also <a href="qprinter.html#setResolution">setResolution</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setCollateCopies" />
<h3 class="fn"><a name="setCollateCopies" />QPrinter.setCollateCopies (<i>self</i>, bool)</h3><p>Sets the default value for collation checkbox when the print dialog appears. If <i>collate</i> is true, it will enable <a class="compat" href="qprinter-qt3.html#setCollateCopiesEnabled">setCollateCopiesEnabled</a>(). The default value is false. This value will be changed by what the user presses in the print dialog.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qprinter.html#collateCopies">collateCopies</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setColorMode" />
<h3 class="fn"><a name="setColorMode" />QPrinter.setColorMode (<i>self</i>, <a href="qprinter.html#ColorMode-enum">ColorMode</a>)</h3><p>Sets the printer's color mode to <i>newColorMode</i>, which can be either <tt>Color</tt> or <tt>GrayScale</tt>.</p>
<p>See also <a href="qprinter.html#colorMode">colorMode</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setCreator" />
<h3 class="fn"><a name="setCreator" />QPrinter.setCreator (<i>self</i>, QString)</h3><p>Sets the name of the application that created the document to <i>creator</i>.</p>
<p>This function is only applicable to the X11 version of Qt. If no creator name is specified, the creator will be set to "Qt" followed by some version number.</p>
<p>See also <a href="qprinter.html#creator">creator</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setDocName" />
<h3 class="fn"><a name="setDocName" />QPrinter.setDocName (<i>self</i>, QString)</h3><p>Sets the document name to <i>name</i>.</p>
<p>On X11, the document name is for example used as the default output filename in <a href="qprintdialog.html">QPrintDialog</a>. Note that the document name does not affect the file name if the printer is printing to a file. Use the setOutputFile() function for this.</p>
<p>See also <a href="qprinter.html#docName">docName</a>() and <a href="qprintengine.html#PrintEnginePropertyKey-enum">QPrintEngine.PrintEnginePropertyKey</a>.</p>
<a name="//apple_ref/cpp/instm/QPrinter/setDoubleSidedPrinting" />
<h3 class="fn"><a name="setDoubleSidedPrinting" />QPrinter.setDoubleSidedPrinting (<i>self</i>, bool)</h3><p>Enables double sided printing if <i>doubleSided</i> is true; otherwise disables it.</p>
<p>Currently this option is only supported on X11.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qprinter.html#doubleSidedPrinting">doubleSidedPrinting</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setDuplex" />
<h3 class="fn"><a name="setDuplex" />QPrinter.setDuplex (<i>self</i>, <a href="qprinter.html#DuplexMode-enum">DuplexMode</a>)</h3><p>Enables double sided printing based on the <i>duplex</i> mode.</p>
<p>Currently this option is only supported on X11.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qprinter.html#duplex">duplex</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setEngines" />
<h3 class="fn"><a name="setEngines" />QPrinter.setEngines (<i>self</i>, <a href="qprintengine.html">QPrintEngine</a>, <a href="qpaintengine.html">QPaintEngine</a>)</h3><p>This function is used by subclasses of <a href="qprinter.html">QPrinter</a> to specify custom print and paint engines (<i>printEngine</i> and <i>paintEngine</i>, respectively).</p>
<p><a href="qprinter.html">QPrinter</a> does not take ownership of the engines, so you need to manage these engine instances yourself.</p>
<p>Note that changing the engines will reset the printer state and all its properties.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qprinter.html#printEngine">printEngine</a>(), <a href="qprinter.html#paintEngine">paintEngine</a>(), and <a href="qprinter.html#setOutputFormat">setOutputFormat</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setFontEmbeddingEnabled" />
<h3 class="fn"><a name="setFontEmbeddingEnabled" />QPrinter.setFontEmbeddingEnabled (<i>self</i>, bool)</h3><p>Enabled or disables font embedding depending on <i>enable</i>.</p>
<p>Currently this option is only supported on X11.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qprinter.html#fontEmbeddingEnabled">fontEmbeddingEnabled</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setFromTo" />
<h3 class="fn"><a name="setFromTo" />QPrinter.setFromTo (<i>self</i>, int, int)</h3><p>Sets the range of pages to be printed to cover the pages with numbers specified by <i>from</i> and <i>to</i>, where <i>from</i> corresponds to the first page in the range and <i>to</i> corresponds to the last.</p>
<p><b>Note:</b> Pages in a document are numbered according to the convention that the first page is page 1. However, if <i>from</i> and <i>to</i> are both set to 0, the <i>whole document will be printed</i>.</p>
<p>This function is mostly used to set a default value that the user can override in the print dialog when you call <a class="compat" href="qprinter-qt3.html#setup">setup</a>().</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qprinter.html#fromPage">fromPage</a>() and <a href="qprinter.html#toPage">toPage</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setFullPage" />
<h3 class="fn"><a name="setFullPage" />QPrinter.setFullPage (<i>self</i>, bool)</h3><p>If <i>fp</i> is true, enables support for painting over the entire page; otherwise restricts painting to the printable area reported by the device.</p>
<p>By default, full page printing is disabled. In this case, the origin of the <a href="qprinter.html">QPrinter</a>'s coordinate system coincides with the top-left corner of the printable area.</p>
<p>If full page printing is enabled, the origin of the <a href="qprinter.html">QPrinter</a>'s coordinate system coincides with the top-left corner of the paper itself. In this case, the <a href="qpaintdevice.html#PaintDeviceMetric-enum">device metrics</a> will report the exact same dimensions as indicated by <a href="qprinter.html#PaperSize-enum">PaperSize</a>. It may not be possible to print on the entire physical page because of the printer's margins, so the application must account for the margins itself.</p>
<p>See also <a href="qprinter.html#fullPage">fullPage</a>(), <a href="qprinter.html#setPaperSize">setPaperSize</a>(), <a href="qpaintdevice.html#width">width</a>(), <a href="qpaintdevice.html#height">height</a>(), and <a href="printing.html">Printing with Qt</a>.</p>
<a name="//apple_ref/cpp/instm/QPrinter/setNumCopies" />
<h3 class="fn"><a name="setNumCopies" />QPrinter.setNumCopies (<i>self</i>, int)</h3><p>Sets the number of copies to be printed to <i>numCopies</i>.</p>
<p>The printer driver reads this setting and prints the specified number of copies.</p>
<p>See also <a href="qprinter.html#numCopies">numCopies</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setOrientation" />
<h3 class="fn"><a name="setOrientation" />QPrinter.setOrientation (<i>self</i>, <a href="qprinter.html#Orientation-enum">Orientation</a>)</h3><p>Sets the print orientation to <i>orientation</i>.</p>
<p>The orientation can be either <a href="qprinter.html#Orientation-enum">QPrinter.Portrait</a> or <a href="qprinter.html#Orientation-enum">QPrinter.Landscape</a>.</p>
<p>The printer driver reads this setting and prints using the specified orientation.</p>
<p>On Windows, this option can be changed while printing and will take effect from the next call to <a href="qprinter.html#newPage">newPage</a>().</p>
<p>On Mac OS X, changing the orientation during a print job has no effect.</p>
<p>See also <a href="qprinter.html#orientation">orientation</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setOutputFileName" />
<h3 class="fn"><a name="setOutputFileName" />QPrinter.setOutputFileName (<i>self</i>, QString)</h3><p>Sets the name of the output file to <i>fileName</i>.</p>
<p>Setting a null or empty name (0 or "") disables printing to a file. Setting a non-empty name enables printing to a file.</p>
<p>This can change the value of <a href="qprinter.html#outputFormat">outputFormat</a>(). If the file name has the suffix ".ps" then PostScript is automatically selected as output format. If the file name has the ".pdf" suffix PDF is generated. If the file name has a suffix other than ".ps" and ".pdf", the output format used is the one set with <a href="qprinter.html#setOutputFormat">setOutputFormat</a>().</p>
<p><a href="qprinter.html">QPrinter</a> uses Qt's cross-platform PostScript or PDF print engines respectively. If you can produce this format natively, for example Mac OS X can generate PDF's from its print engine, set the output format back to <a href="qprinter.html#OutputFormat-enum">NativeFormat</a>.</p>
<p>See also <a href="qprinter.html#outputFileName">outputFileName</a>(), <a class="compat" href="qprinter-qt3.html#setOutputToFile">setOutputToFile</a>(), and <a href="qprinter.html#setOutputFormat">setOutputFormat</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setOutputFormat" />
<h3 class="fn"><a name="setOutputFormat" />QPrinter.setOutputFormat (<i>self</i>, <a href="qprinter.html#OutputFormat-enum">OutputFormat</a>)</h3><p>Sets the output format for this printer to <i>format</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qprinter.html#outputFormat">outputFormat</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setPageMargins" />
<h3 class="fn"><a name="setPageMargins" />QPrinter.setPageMargins (<i>self</i>, float, float, float, float, <a href="qprinter.html#Unit-enum">Unit</a>)</h3><p>This function sets the <i>left</i>, <i>top</i>, <i>right</i> and <i>bottom</i> page margins for this printer. The unit of the margins are specified with the <i>unit</i> parameter.</p>
<p>This function was introduced in Qt 4.4.</p>
<a name="//apple_ref/cpp/instm/QPrinter/setPageOrder" />
<h3 class="fn"><a name="setPageOrder" />QPrinter.setPageOrder (<i>self</i>, <a href="qprinter.html#PageOrder-enum">PageOrder</a>)</h3><p>Sets the page order to <i>pageOrder</i>.</p>
<p>The page order can be <a href="qprinter.html#PageOrder-enum">QPrinter.FirstPageFirst</a> or <a href="qprinter.html#PageOrder-enum">QPrinter.LastPageFirst</a>. The application is responsible for reading the page order and printing accordingly.</p>
<p>This function is mostly useful for setting a default value that the user can override in the print dialog.</p>
<p>This function is only supported under X11.</p>
<p>See also <a href="qprinter.html#pageOrder">pageOrder</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setPaperSize" />
<h3 class="fn"><a name="setPageSize" />QPrinter.setPageSize (<i>self</i>, <a href="qprinter.html#PageSize-enum">PageSize</a>)</h3><h3 class="fn"><a name="setPaperSize" />QPrinter.setPaperSize (<i>self</i>, <a href="qprinter.html#PageSize-enum">PageSize</a>)</h3><p>Sets the printer paper size to <i>newPaperSize</i> if that size is supported. The result is undefined if <i>newPaperSize</i> is not supported.</p>
<p>The default paper size is driver-dependent.</p>
<p>This function is useful mostly for setting a default value that the user can override in the print dialog.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qprinter.html#paperSize">paperSize</a>(), <a href="qprinter.html#PaperSize-enum">PaperSize</a>, <a href="qprinter.html#setFullPage">setFullPage</a>(), <a href="qprinter.html#setResolution">setResolution</a>(), <a href="qprinter.html#pageRect">pageRect</a>(), and <a href="qprinter.html#paperRect">paperRect</a>().</p>
<h3 class="fn"><a name="setPaperSize-2" />QPrinter.setPaperSize (<i>self</i>, <a href="qsizef.html">QSizeF</a>, <a href="qprinter.html#Unit-enum">Unit</a>)</h3><p>Sets the paper size based on <i>paperSize</i> in <i>unit</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p>See also <a href="qprinter.html#paperSize">paperSize</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setPaperSource" />
<h3 class="fn"><a name="setPaperSource" />QPrinter.setPaperSource (<i>self</i>, <a href="qprinter.html#PaperSource-enum">PaperSource</a>)</h3><p>Sets the paper source setting to <i>source</i>.</p>
<p>Windows only: This option can be changed while printing and will take effect from the next call to <a href="qprinter.html#newPage">newPage</a>()</p>
<p>See also <a href="qprinter.html#paperSource">paperSource</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setPrintProgram" />
<h3 class="fn"><a name="setPrinterName" />QPrinter.setPrinterName (<i>self</i>, QString)</h3><p>Sets the printer name to <i>name</i>.</p>
<p>See also <a href="qprinter.html#printerName">printerName</a>() and <a href="qprinter.html#isValid">isValid</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setPrinterSelectionOption" />
<h3 class="fn"><a name="setPrinterSelectionOption" />QPrinter.setPrinterSelectionOption (<i>self</i>, QString)</h3><p>Sets the printer to use <i>option</i> to select the printer. <i>option</i> is null by default (which implies that Qt should be smart enough to guess correctly), but it can be set to other values to use a specific printer selection option.</p>
<p>If the printer selection option is changed while the printer is active, the current print job may or may not be affected.</p>
<p><b>Warning:</b> This function is not available on Windows.</p>
<p>See also <a href="qprinter.html#printerSelectionOption">printerSelectionOption</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setResolution" />
<h3 class="fn"><a name="setPrintProgram" />QPrinter.setPrintProgram (<i>self</i>, QString)</h3><p>Sets the name of the program that should do the print job to <i>printProg</i>.</p>
<p>On X11, this function sets the program to call with the PostScript output. On other platforms, it has no effect.</p>
<p>See also <a href="qprinter.html#printProgram">printProgram</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setPrintRange" />
<h3 class="fn"><a name="setPrintRange" />QPrinter.setPrintRange (<i>self</i>, <a href="qprinter.html#PrintRange-enum">PrintRange</a>)</h3><p>Sets the print range option in to be <i>range</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qprinter.html#printRange">printRange</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setPrinterName" />
<h3 class="fn"><a name="setResolution" />QPrinter.setResolution (<i>self</i>, int)</h3><p>Requests that the printer prints at <i>dpi</i> or as near to <i>dpi</i> as possible.</p>
<p>This setting affects the coordinate system as returned by, for example <a href="qpainter.html#viewport">QPainter.viewport</a>().</p>
<p>This function must be called before <a href="qpainter.html#begin">QPainter.begin</a>() to have an effect on all platforms.</p>
<p>See also <a href="qprinter.html#resolution">resolution</a>() and <a href="qprinter.html#setPaperSize">setPaperSize</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/setWinPageSize" />
<h3 class="fn"><a name="supportedResolutions" />list-of-int QPrinter.supportedResolutions (<i>self</i>)</h3><p>Returns a list of the resolutions (a list of dots-per-inch integers) that the printer says it supports.</p>
<p>For X11 where all printing is directly to postscript, this function will always return a one item list containing only the postscript resolution, i.e., 72 (72 dpi -- but see <a href="qprinter.html#PrinterMode-enum">PrinterMode</a>).</p>
<a name="//apple_ref/cpp/instm/QPrinter/toPage" />
<h3 class="fn"><a name="toPage" />int QPrinter.toPage (<i>self</i>)</h3><p>Returns the number of the last page in a range of pages to be printed (the "to page" setting). Pages in a document are numbered according to the convention that the first page is page 1.</p>
<p>By default, this function returns a special value of 0, meaning that the "to page" setting is unset.</p>
<p><b>Note:</b> If <a href="qprinter.html#fromPage">fromPage</a>() and toPage() both return 0, this indicates that <i>the whole document will be printed</i>.</p>
<p>The programmer is responsible for reading this setting and printing accordingly.</p>
<p>This function was introduced in Qt 4.1.</p>
<p>See also <a href="qprinter.html#setFromTo">setFromTo</a>() and <a href="qprinter.html#fromPage">fromPage</a>().</p>
<a name="//apple_ref/cpp/instm/QPrinter/winPageSize" />
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.6.2</td></tr></table></div></address></body></html>
|