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 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907
|
<?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="index.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, CurrentPage }</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 <i>printer</i>, 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" />int <b><a href="qprinter.html#copyCount">copyCount</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" />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 <i>left</i>, float <i>top</i>, float <i>right</i>, float <i>bottom</i>) <b><a href="qprinter.html#getPageMargins">getPageMargins</a></b> (<i>self</i>, Unit <i>unit</i>)</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 <i>unit</i>)</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 <i>collate</i>)</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#setCopyCount">setCopyCount</a></b> (<i>self</i>, int)</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 <i>enable</i>)</li><li><div class="fn" /><b><a href="qprinter.html#setDuplex">setDuplex</a></b> (<i>self</i>, DuplexMode <i>duplex</i>)</li><li><div class="fn" /><b><a href="qprinter.html#setEngines">setEngines</a></b> (<i>self</i>, QPrintEngine <i>printEngine</i>, QPaintEngine <i>paintEngine</i>)</li><li><div class="fn" /><b><a href="qprinter.html#setFontEmbeddingEnabled">setFontEmbeddingEnabled</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qprinter.html#setFromTo">setFromTo</a></b> (<i>self</i>, int <i>fromPage</i>, int <i>toPage</i>)</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 <i>format</i>)</li><li><div class="fn" /><b><a href="qprinter.html#setPageMargins">setPageMargins</a></b> (<i>self</i>, float <i>left</i>, float <i>top</i>, float <i>right</i>, float <i>bottom</i>, Unit <i>unit</i>)</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 <i>paperSize</i>, Unit <i>unit</i>)</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 <i>range</i>)</li><li><div class="fn" /><b><a href="qprinter.html#setResolution">setResolution</a></b> (<i>self</i>, int)</li><li><div class="fn" />unknown-type <b><a href="qprinter.html#supportedResolutions">supportedResolutions</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qprinter.html#supportsMultipleCopies">supportsMultipleCopies</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#setCopyCount">setCopyCount</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>
<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>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Color</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">print in color if available, otherwise in
grayscale.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.GrayScale</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">print in grayscale, even on color
printers.</td>
</tr>
</table>
<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>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.DuplexNone</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Single sided (simplex) printing only.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.DuplexAuto</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The printer's default setting is used to
determine whether duplex printing is used.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.DuplexLongSide</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">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 class="topAlign"><tt>QPrinter.DuplexShortSide</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">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>This enum was introduced or modified in Qt 4.4.</p>
<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>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Portrait</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">the page's height is greater than its
width.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Landscape</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">the page's width is greater than its
height.</td>
</tr>
</table>
<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>
<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>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.NativeFormat</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign"><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 class="topAlign"><tt>QPrinter.PdfFormat</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign"><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 class="topAlign"><tt>QPrinter.PostScriptFormat</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign"><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><b>See also</b> <a href="qprinter.html#outputFormat">outputFormat</a>(), <a href="qprinter.html#setOutputFormat">setOutputFormat</a>(), and <a href="qprinter.html#setOutputFileName">setOutputFileName</a>().</p>
<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>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.FirstPageFirst</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">the lowest-numbered page should be printed
first.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.LastPageFirst</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">the highest-numbered page should be printed
first.</td>
</tr>
</table>
<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>
<table class="valuelist">
<tr>
<th class="tblConst">Constant</th>
<th class="tblVal">Value</th>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Auto</tt></td>
<td class="topAlign"><tt>6</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Cassette</tt></td>
<td class="topAlign"><tt>11</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Envelope</tt></td>
<td class="topAlign"><tt>4</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.EnvelopeManual</tt></td>
<td class="topAlign"><tt>5</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.FormSource</tt></td>
<td class="topAlign"><tt>12</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.LargeCapacity</tt></td>
<td class="topAlign"><tt>10</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.LargeFormat</tt></td>
<td class="topAlign"><tt>9</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Lower</tt></td>
<td class="topAlign"><tt>1</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.MaxPageSource</tt></td>
<td class="topAlign"><tt>13</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Middle</tt></td>
<td class="topAlign"><tt>2</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Manual</tt></td>
<td class="topAlign"><tt>3</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.OnlyOne</tt></td>
<td class="topAlign"><tt>0</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Tractor</tt></td>
<td class="topAlign"><tt>7</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.SmallFormat</tt></td>
<td class="topAlign"><tt>8</tt></td>
</tr>
</table>
<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>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.ScreenResolution</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">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 class="topAlign"><tt>QPrinter.PrinterResolution</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">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 class="topAlign"><tt>QPrinter.HighResolution</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">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><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>
<h3 class="fn"><a name="PrinterState-enum" />QPrinter.PrinterState</h3><table class="valuelist">
<tr>
<th class="tblConst">Constant</th>
<th class="tblVal">Value</th>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Idle</tt></td>
<td class="topAlign"><tt>0</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Active</tt></td>
<td class="topAlign"><tt>1</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Aborted</tt></td>
<td class="topAlign"><tt>2</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Error</tt></td>
<td class="topAlign"><tt>3</tt></td>
</tr>
</table>
<h3 class="fn"><a name="PrintRange-enum" />QPrinter.PrintRange</h3><p>Used to specify the print range selection option.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.AllPages</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">All pages should be printed.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Selection</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Only the selection should be printed.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.PageRange</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The specified page range should be
printed.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.CurrentPage</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">Only the current page should be printed.</td>
</tr>
</table>
<p><b>See also</b> <a href="qabstractprintdialog.html#PrintRange-enum">QAbstractPrintDialog.PrintRange</a>.</p>
<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>
<table class="valuelist">
<tr>
<th class="tblConst">Constant</th>
<th class="tblVal">Value</th>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Millimeter</tt></td>
<td class="topAlign"><tt>0</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Point</tt></td>
<td class="topAlign"><tt>1</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Inch</tt></td>
<td class="topAlign"><tt>2</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Pica</tt></td>
<td class="topAlign"><tt>3</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Didot</tt></td>
<td class="topAlign"><tt>4</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.Cicero</tt></td>
<td class="topAlign"><tt>5</tt></td>
</tr>
<tr>
<td class="topAlign"><tt>QPrinter.DevicePixel</tt></td>
<td class="topAlign"><tt>6</tt></td>
</tr>
</table>
<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 or modified 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> <i>printer</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>printer</i> and
<i>mode</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<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>
<h3 class="fn"><a name="actualNumCopies" />int QPrinter.actualNumCopies (<i>self</i>)</h3><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 class="obsolete" href="qprinter-obsolete.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><b>See also</b> <a href="qprinter.html#setCollateCopies">setCollateCopies</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setColorMode">setColorMode</a>().</p>
<h3 class="fn"><a name="copyCount" />int QPrinter.copyCount (<i>self</i>)</h3><p>Returns the number of copies that will be printed. The default
value is 1.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qprinter.html#setCopyCount">setCopyCount</a>() and <a href="qprinter.html#supportsMultipleCopies">supportsMultipleCopies</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setCreator">setCreator</a>().</p>
<h3 class="fn"><a name="docName" />QString QPrinter.docName (<i>self</i>)</h3><p>Returns the document name.</p>
<p><b>See also</b> <a href="qprinter.html#setDocName">setDocName</a>() and <a href="qprintengine.html#PrintEnginePropertyKey-enum">QPrintEngine.PrintEnginePropertyKey</a>.</p>
<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><b>See also</b> <a href="qprinter.html#setDoubleSidedPrinting">setDoubleSidedPrinting</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setDuplex">setDuplex</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setFontEmbeddingEnabled">setFontEmbeddingEnabled</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setFromTo">setFromTo</a>() and <a href="qprinter.html#toPage">toPage</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setFullPage">setFullPage</a>() and <a href="qprinter.html#PaperSize-enum">PaperSize</a>.</p>
<h3 class="fn"><a name="getPageMargins" />(float <i>left</i>, float <i>top</i>, float <i>right</i>, float <i>bottom</i>) QPrinter.getPageMargins (<i>self</i>, <a href="qprinter.html#Unit-enum">Unit</a> <i>unit</i>)</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>
<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 class="cpp">
<span class="type"><a href="qprinter.html">QPrinter</a></span> printer;
printer<span class="operator">.</span>setOutputFormat(<span class="type"><a href="qprinter.html">QPrinter</a></span><span class="operator">.</span>PdfFormat);
printer<span class="operator">.</span>setOutputFileName(<span class="string">"/foobar/nonwritable.pdf"</span>);
<span class="type"><a href="qpainter.html">QPainter</a></span> painter;
<span class="keyword">if</span> (<span class="operator">!</span> painter<span class="operator">.</span>begin(<span class="operator">&</span>printer)) { <span class="comment">// failed to open file</span>
<a href="qtcore.html#qWarning">qWarning</a>(<span class="string">"failed to open file, is it writable?"</span>);
<span class="keyword">return</span> <span class="number">1</span>;
}
painter<span class="operator">.</span>drawText(<span class="number">10</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="string">"Test"</span>);
<span class="keyword">if</span> (<span class="operator">!</span> printer<span class="operator">.</span>newPage()) {
<a href="qtcore.html#qWarning">qWarning</a>(<span class="string">"failed in flushing page to disk, disk full?"</span>);
<span class="keyword">return</span> <span class="number">1</span>;
}
painter<span class="operator">.</span>drawText(<span class="number">10</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="string">"Test 2"</span>);
painter<span class="operator">.</span>end();
</pre>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qprinter.html#setPrinterName">setPrinterName</a>().</p>
<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>
<h3 class="fn"><a name="numCopies" />int QPrinter.numCopies (<i>self</i>)</h3><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><b>See also</b> <a href="qprinter.html#setOrientation">setOrientation</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setOutputFileName">setOutputFileName</a>() and
<a href="qprintengine.html#PrintEnginePropertyKey-enum">QPrintEngine.PrintEnginePropertyKey</a>.</p>
<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><b>See also</b> <a href="qprinter.html#setOutputFormat">setOutputFormat</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setPageOrder">setPageOrder</a>().</p>
<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><b>See also</b> <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><b>See also</b> <a href="qprinter.html#paperSize">paperSize</a>().</p>
<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>
<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><b>See also</b> <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><b>See also</b> <a href="qprinter.html#pageRect">pageRect</a>().</p>
<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><b>See also</b> <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> <i>unit</i>)</h3><p>Returns the paper size in <i>unit</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qprinter.html#setPaperSize">setPaperSize</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setPaperSource">setPaperSource</a>().</p>
<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>
<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><b>See also</b> <a href="qprinter.html#setPrinterName">setPrinterName</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setPrinterSelectionOption">setPrinterSelectionOption</a>().</p>
<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>
<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><b>See also</b> <a href="qprinter.html#setPrintProgram">setPrintProgram</a>() and <a href="qprinter.html#setPrinterSelectionOption">setPrinterSelectionOption</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setPrintRange">setPrintRange</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setResolution">setResolution</a>().</p>
<h3 class="fn"><a name="setCollateCopies" />QPrinter.setCollateCopies (<i>self</i>, bool <i>collate</i>)</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><b>See also</b> <a href="qprinter.html#collateCopies">collateCopies</a>().</p>
<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><b>See also</b> <a href="qprinter.html#colorMode">colorMode</a>().</p>
<h3 class="fn"><a name="setCopyCount" />QPrinter.setCopyCount (<i>self</i>, int)</h3><p>Sets the number of copies to be printed to <i>count</i>.</p>
<p>The printer driver reads this setting and prints the specified
number of copies.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qprinter.html#copyCount">copyCount</a>() and <a href="qprinter.html#supportsMultipleCopies">supportsMultipleCopies</a>().</p>
<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><b>See also</b> <a href="qprinter.html#creator">creator</a>().</p>
<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><b>See also</b> <a href="qprinter.html#docName">docName</a>()
and <a href="qprintengine.html#PrintEnginePropertyKey-enum">QPrintEngine.PrintEnginePropertyKey</a>.</p>
<h3 class="fn"><a name="setDoubleSidedPrinting" />QPrinter.setDoubleSidedPrinting (<i>self</i>, bool <i>enable</i>)</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><b>See also</b> <a href="qprinter.html#doubleSidedPrinting">doubleSidedPrinting</a>().</p>
<h3 class="fn"><a name="setDuplex" />QPrinter.setDuplex (<i>self</i>, <a href="qprinter.html#DuplexMode-enum">DuplexMode</a> <i>duplex</i>)</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><b>See also</b> <a href="qprinter.html#duplex">duplex</a>().</p>
<h3 class="fn"><a name="setEngines" />QPrinter.setEngines (<i>self</i>, <a href="qprintengine.html">QPrintEngine</a> <i>printEngine</i>, <a href="qpaintengine.html">QPaintEngine</a> <i>paintEngine</i>)</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><b>See also</b> <a href="qprinter.html#printEngine">printEngine</a>(), <a href="qprinter.html#paintEngine">paintEngine</a>(), and <a href="qprinter.html#setOutputFormat">setOutputFormat</a>().</p>
<h3 class="fn"><a name="setFontEmbeddingEnabled" />QPrinter.setFontEmbeddingEnabled (<i>self</i>, bool <i>enable</i>)</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><b>See also</b> <a href="qprinter.html#fontEmbeddingEnabled">fontEmbeddingEnabled</a>().</p>
<h3 class="fn"><a name="setFromTo" />QPrinter.setFromTo (<i>self</i>, int <i>fromPage</i>, int <i>toPage</i>)</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><b>See also</b> <a href="qprinter.html#fromPage">fromPage</a>()
and <a href="qprinter.html#toPage">toPage</a>().</p>
<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><b>See also</b> <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>
<h3 class="fn"><a name="setNumCopies" />QPrinter.setNumCopies (<i>self</i>, int)</h3><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><b>See also</b> <a href="qprinter.html#orientation">orientation</a>().</p>
<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><b>See also</b> <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>
<h3 class="fn"><a name="setOutputFormat" />QPrinter.setOutputFormat (<i>self</i>, <a href="qprinter.html#OutputFormat-enum">OutputFormat</a> <i>format</i>)</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><b>See also</b> <a href="qprinter.html#outputFormat">outputFormat</a>().</p>
<h3 class="fn"><a name="setPageMargins" />QPrinter.setPageMargins (<i>self</i>, float <i>left</i>, float <i>top</i>, float <i>right</i>, float <i>bottom</i>, <a href="qprinter.html#Unit-enum">Unit</a> <i>unit</i>)</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>
<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><b>See also</b> <a href="qprinter.html#pageOrder">pageOrder</a>().</p>
<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><b>See also</b> <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> <i>paperSize</i>, <a href="qprinter.html#Unit-enum">Unit</a> <i>unit</i>)</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><b>See also</b> <a href="qprinter.html#paperSize">paperSize</a>().</p>
<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><b>See also</b> <a href="qprinter.html#paperSource">paperSource</a>().</p>
<h3 class="fn"><a name="setPrinterName" />QPrinter.setPrinterName (<i>self</i>, QString)</h3><p>Sets the printer name to <i>name</i>.</p>
<p><b>See also</b> <a href="qprinter.html#printerName">printerName</a>() and <a href="qprinter.html#isValid">isValid</a>().</p>
<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><b>See also</b> <a href="qprinter.html#printerSelectionOption">printerSelectionOption</a>().</p>
<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><b>See also</b> <a href="qprinter.html#printProgram">printProgram</a>().</p>
<h3 class="fn"><a name="setPrintRange" />QPrinter.setPrintRange (<i>self</i>, <a href="qprinter.html#PrintRange-enum">PrintRange</a> <i>range</i>)</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><b>See also</b> <a href="qprinter.html#printRange">printRange</a>().</p>
<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><b>See also</b> <a href="qprinter.html#resolution">resolution</a>() and <a href="qprinter.html#setPaperSize">setPaperSize</a>().</p>
<h3 class="fn"><a name="supportedResolutions" />unknown-type 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>
<h3 class="fn"><a name="supportsMultipleCopies" />bool QPrinter.supportsMultipleCopies (<i>self</i>)</h3><p>Returns true if the printer supports printing multiple copies of
the same document in one job; otherwise false is returned.</p>
<p>On most systems this function will return true. However, on X11
systems that do not support CUPS, this function will return false.
That means the application has to handle the number of copies by
printing the same document the required number of times.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qprinter.html#setCopyCount">setCopyCount</a>() and <a href="qprinter.html#copyCount">copyCount</a>().</p>
<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><b>See also</b> <a href="qprinter.html#setFromTo">setFromTo</a>() and <a href="qprinter.html#fromPage">fromPage</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|