Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > d5e62c01ae8d1e579463c6a871dd44bf > files > 2480

qtbase5-doc-5.12.6-2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qprinter.cpp -->
  <title>QPrinter Class | Qt Print Support 5.12.6</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qtprintsupport-index.html">Qt Print Support</a></td><td ><a href="qtprintsupport-module.html">C++ Classes</a></td><td >QPrinter</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtprintsupport-index.html">Qt 5.12.6 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#reimplemented-public-functions">Reimplemented Public Functions</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QPrinter Class</h1>
<!-- $$$QPrinter-brief -->
<p>The <a href="qprinter.html">QPrinter</a> class is a paint device that paints on a printer. <a href="#details">More...</a></p>
<!-- @@@QPrinter -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QPrinter&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += printsupport</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtgui/qpagedpaintdevice.html">QPagedPaintDevice</a></td></tr></table></div><ul>
<li><a href="qprinter-members.html">List of all members, including inherited members</a></li>
<li><a href="qprinter-obsolete.html">Obsolete members</a></li>
</ul>
<p><b>Note:</b> All functions in this class are reentrant.</p>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#ColorMode-enum">ColorMode</a></b> { Color, GrayScale }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#DuplexMode-enum">DuplexMode</a></b> { DuplexNone, DuplexAuto, DuplexLongSide, DuplexShortSide }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#Orientation-enum">Orientation</a></b> { Portrait, Landscape }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#OutputFormat-enum">OutputFormat</a></b> { NativeFormat, PdfFormat }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#PageOrder-enum">PageOrder</a></b> { FirstPageFirst, LastPageFirst }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#PaperSize-typedef">PaperSize</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#PaperSource-enum">PaperSource</a></b> { Auto, Cassette, Envelope, EnvelopeManual, ..., LastPaperSource }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#PrintRange-enum">PrintRange</a></b> { AllPages, Selection, PageRange, CurrentPage }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#PrinterMode-enum">PrinterMode</a></b> { ScreenResolution, PrinterResolution, HighResolution }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#PrinterState-enum">PrinterState</a></b> { Idle, Active, Aborted, Error }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#Unit-enum">Unit</a></b> { Millimeter, Point, Inch, Pica, ..., DevicePixel }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#QPrinter">QPrinter</a></b>(QPrinter::PrinterMode <i>mode</i> = ScreenResolution)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#QPrinter-1">QPrinter</a></b>(const QPrinterInfo &amp;<i>printer</i>, QPrinter::PrinterMode <i>mode</i> = ScreenResolution)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#dtor.QPrinter">~QPrinter</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#abort">abort</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#collateCopies">collateCopies</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPrinter::ColorMode </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#colorMode">colorMode</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#copyCount">copyCount</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#creator">creator</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#docName">docName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPrinter::DuplexMode </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#duplex">duplex</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#fontEmbeddingEnabled">fontEmbeddingEnabled</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#fromPage">fromPage</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#fullPage">fullPage</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#isValid">isValid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#outputFileName">outputFileName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPrinter::OutputFormat </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#outputFormat">outputFormat</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPageLayout </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#pageLayout">pageLayout</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPrinter::PageOrder </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#pageOrder">pageOrder</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#pageRect">pageRect</a></b>(QPrinter::Unit <i>unit</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#paperRect">paperRect</a></b>(QPrinter::Unit <i>unit</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPrinter::PaperSource </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#paperSource">paperSource</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPagedPaintDevice::PdfVersion </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#pdfVersion">pdfVersion</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPrintEngine *</td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#printEngine">printEngine</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#printProgram">printProgram</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPrinter::PrintRange </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#printRange">printRange</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#printerName">printerName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#printerSelectionOption">printerSelectionOption</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPrinter::PrinterState </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#printerState">printerState</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#resolution">resolution</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setCollateCopies">setCollateCopies</a></b>(bool <i>collate</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setColorMode">setColorMode</a></b>(QPrinter::ColorMode <i>newColorMode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setCopyCount">setCopyCount</a></b>(int <i>count</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setCreator">setCreator</a></b>(const QString &amp;<i>creator</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setDocName">setDocName</a></b>(const QString &amp;<i>name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setDuplex">setDuplex</a></b>(QPrinter::DuplexMode <i>duplex</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setFontEmbeddingEnabled">setFontEmbeddingEnabled</a></b>(bool <i>enable</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setFromTo">setFromTo</a></b>(int <i>from</i>, int <i>to</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setFullPage">setFullPage</a></b>(bool <i>fp</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setOutputFileName">setOutputFileName</a></b>(const QString &amp;<i>fileName</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setOutputFormat">setOutputFormat</a></b>(QPrinter::OutputFormat <i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setPageLayout">setPageLayout</a></b>(const QPageLayout &amp;<i>newLayout</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setPageMargins">setPageMargins</a></b>(const QMarginsF &amp;<i>margins</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setPageMargins-1">setPageMargins</a></b>(const QMarginsF &amp;<i>margins</i>, QPageLayout::Unit <i>units</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setPageOrder">setPageOrder</a></b>(QPrinter::PageOrder <i>pageOrder</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setPageOrientation">setPageOrientation</a></b>(QPageLayout::Orientation <i>orientation</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setPageSize">setPageSize</a></b>(const QPageSize &amp;<i>pageSize</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setPaperSource">setPaperSource</a></b>(QPrinter::PaperSource <i>source</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setPdfVersion">setPdfVersion</a></b>(QPagedPaintDevice::PdfVersion <i>version</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setPrintProgram">setPrintProgram</a></b>(const QString &amp;<i>printProg</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setPrintRange">setPrintRange</a></b>(QPrinter::PrintRange <i>range</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setPrinterName">setPrinterName</a></b>(const QString &amp;<i>name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setPrinterSelectionOption">setPrinterSelectionOption</a></b>(const QString &amp;<i>option</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setResolution">setResolution</a></b>(int <i>dpi</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QPrinter::PaperSource&gt; </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#supportedPaperSources">supportedPaperSources</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;int&gt; </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#supportedResolutions">supportedResolutions</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#supportsMultipleCopies">supportsMultipleCopies</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#toPage">toPage</a></b>() const</td></tr>
</table></div>
<a name="reimplemented-public-functions"></a>
<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#newPage">newPage</a></b>() override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QPaintEngine *</td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#paintEngine">paintEngine</a></b>() const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> <code>(obsolete) </code>virtual void </td><td class="memItemRight bottomAlign"><b><a href="qprinter-obsolete.html#setMargins">setMargins</a></b>(const QPagedPaintDevice::Margins &amp;<i>m</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> <code>(obsolete) </code>virtual void </td><td class="memItemRight bottomAlign"><b><a href="qprinter-obsolete.html#setPageSize-1">setPageSize</a></b>(QPagedPaintDevice::PageSize <i>newPageSize</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> <code>(obsolete) </code>virtual void </td><td class="memItemRight bottomAlign"><b><a href="qprinter-obsolete.html#setPageSizeMM">setPageSizeMM</a></b>(const QSizeF &amp;<i>size</i>) override</td></tr>
</table></div>
<ul>
<li class="fn">13 public functions inherited from <a href="../qtgui/qpagedpaintdevice.html#public-functions">QPagedPaintDevice</a></li>
<li class="fn">14 public functions inherited from <a href="../qtgui/qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="protected-functions"></a>
<h2 id="protected-functions">Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprinter.html#setEngines">setEngines</a></b>(QPrintEngine *<i>printEngine</i>, QPaintEngine *<i>paintEngine</i>)</td></tr>
</table></div>
<ul>
<li class="fn">1 protected function inherited from <a href="../qtgui/qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<a name="details"></a>
<!-- $$$QPrinter-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qprinter.html">QPrinter</a> 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="../qtwidgets/qwidget.html">QWidget</a> and <a href="../qtgui/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 macOS, <a href="qprinter.html">QPrinter</a> uses the built-in printer drivers. On X11, <a href="qprinter.html">QPrinter</a> uses the Common Unix Printing System (CUPS) to send 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><a href="qprinter.html">QPrinter</a> 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, <a href="qprinter.html">QPrinter</a> passes these functions onto the underlying <a href="qprintengine.html">QPrintEngine</a>.</p>
<p>The most important parameters are:</p>
<ul>
<li>setOrientation() tells <a href="qprinter.html">QPrinter</a> which page orientation to use.</li>
<li>setPaperSize() tells <a href="qprinter.html">QPrinter</a> what paper size to expect from the printer.</li>
<li><a href="qprinter.html#setResolution">setResolution</a>() tells <a href="qprinter.html">QPrinter</a> what resolution you wish the printer to provide, in dots per inch (DPI).</li>
<li><a href="qprinter.html#setFullPage">setFullPage</a>() tells <a href="qprinter.html">QPrinter</a> 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 <a href="qprinter.html">QPrinter</a> 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&#x2e;, before <a href="../qtgui/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="../qtgui/qpainter.html#begin">QPainter::begin</a>() is called, the <a href="qprinter.html">QPrinter</a> it operates on is prepared for a new page, enabling the <a href="../qtgui/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="../qtgui/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="../qtgui/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 <a href="qprinter.html">QPrinter</a> 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>
</div>
<p><b>See also </b><a href="qprintdialog.html">QPrintDialog</a> and <a href="qtprintsupport-index.html">Qt Print Support</a>.</p>
<!-- @@@QPrinter -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$ColorMode$$$GrayScale$$$Color -->
<h3 class="fn" id="ColorMode-enum"><a name="ColorMode-enum"></a>enum QPrinter::<span class="name">ColorMode</span></h3>
<p>This enum type is used to indicate whether <a href="qprinter.html">QPrinter</a> should print in color or not.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QPrinter::Color</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">print in color if available, otherwise in grayscale.</td></tr>
<tr><td class="topAlign"><code>QPrinter::GrayScale</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">print in grayscale, even on color printers.</td></tr>
</table></div>
<!-- @@@ColorMode -->
<!-- $$$DuplexMode$$$DuplexNone$$$DuplexAuto$$$DuplexLongSide$$$DuplexShortSide -->
<h3 class="fn" id="DuplexMode-enum"><a name="DuplexMode-enum"></a>enum QPrinter::<span class="name">DuplexMode</span></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>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QPrinter::DuplexNone</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Single sided (simplex) printing only.</td></tr>
<tr><td class="topAlign"><code>QPrinter::DuplexAuto</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The printer's default setting is used to determine whether duplex printing is used.</td></tr>
<tr><td class="topAlign"><code>QPrinter::DuplexLongSide</code></td><td class="topAlign tblval"><code>2</code></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"><code>QPrinter::DuplexShortSide</code></td><td class="topAlign tblval"><code>3</code></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></div>
<p>This enum was introduced or modified in  Qt 4.4.</p>
<!-- @@@DuplexMode -->
<!-- $$$Orientation$$$Portrait$$$Landscape -->
<h3 class="fn" id="Orientation-enum"><a name="Orientation-enum"></a>enum QPrinter::<span class="name">Orientation</span></h3>
<p>This enum type (not to be confused with <code>Orientation</code>) is used to specify each page's orientation.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QPrinter::Portrait</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">the page's height is greater than its width.</td></tr>
<tr><td class="topAlign"><code>QPrinter::Landscape</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">the page's width is greater than its height.</td></tr>
</table></div>
<p>This type interacts with <a href="qprinter.html#PaperSize-typedef">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>
<!-- @@@Orientation -->
<!-- $$$OutputFormat$$$NativeFormat$$$PdfFormat -->
<h3 class="fn" id="OutputFormat-enum"><a name="OutputFormat-enum"></a>enum QPrinter::<span class="name">OutputFormat</span></h3>
<p>The OutputFormat enum is used to describe the format <a href="qprinter.html">QPrinter</a> should use for printing.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QPrinter::NativeFormat</code></td><td class="topAlign tblval"><code>0</code></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"><code>QPrinter::PdfFormat</code></td><td class="topAlign tblval"><code>1</code></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>
</table></div>
<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>
<!-- @@@OutputFormat -->
<!-- $$$PageOrder$$$FirstPageFirst$$$LastPageFirst -->
<h3 class="fn" id="PageOrder-enum"><a name="PageOrder-enum"></a>enum QPrinter::<span class="name">PageOrder</span></h3>
<p>This enum type is used by <a href="qprinter.html">QPrinter</a> to tell the application program how to print.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QPrinter::FirstPageFirst</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">the lowest-numbered page should be printed first.</td></tr>
<tr><td class="topAlign"><code>QPrinter::LastPageFirst</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">the highest-numbered page should be printed first.</td></tr>
</table></div>
<!-- @@@PageOrder -->
<!-- $$$PaperSize -->
<h3 class="fn" id="PaperSize-typedef"><a name="PaperSize-typedef"></a>typedef QPrinter::<span class="name">PaperSize</span></h3>
<p>typdef for the enum <a href="../qtgui/qpagedpaintdevice.html#PageSize-enum">QPagedPaintDevice::PageSize</a>.</p>
<p>This enum type specifies what paper size <a href="qprinter.html">QPrinter</a> should use. <a href="qprinter.html">QPrinter</a> does not check that the paper size is available; it just uses this information, together with <a href="qprinter.html#Orientation-enum">QPrinter::Orientation</a> and <a href="qprinter.html#setFullPage">QPrinter::setFullPage</a>(), to determine the printable area.</p>
<p>The defined sizes (with <a href="qprinter.html#setFullPage">setFullPage</a>(true)) are found in <a href="../qtgui/qpagedpaintdevice.html">QPagedPaintDevice</a>.</p>
<p>With <a href="qprinter.html#setFullPage">setFullPage</a>(false) (the default), the metrics will be a bit smaller; how much depends on the printer in use.</p>
<p>Due to historic reasons <a href="../qtgui/qpagesize.html#PageSizeId-enum">QPageSize::Executive</a> is not the same as the standard Postscript and Windows Executive size, use <a href="../qtgui/qpagesize.html#PageSizeId-enum">QPageSize::ExecutiveStandard</a> instead.</p>
<p>The Postscript standard size <a href="../qtgui/qpagesize.html#PageSizeId-enum">QPageSize::Folio</a> is different to the Windows DMPAPER_FOLIO size, use the Postscript standard size <a href="../qtgui/qpagesize.html#PageSizeId-enum">QPageSize::FanFoldGermanLegal</a> if needed.</p>
<p>This typedef was introduced in  Qt 4.4.</p>
<!-- @@@PaperSize -->
<!-- $$$PaperSource$$$OnlyOne$$$Lower$$$Middle$$$Manual$$$Envelope$$$EnvelopeManual$$$Auto$$$Tractor$$$SmallFormat$$$LargeFormat$$$LargeCapacity$$$Cassette$$$FormSource$$$MaxPageSource$$$CustomSource$$$LastPaperSource$$$Upper -->
<h3 class="fn" id="PaperSource-enum"><a name="PaperSource-enum"></a>enum QPrinter::<span class="name">PaperSource</span></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>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QPrinter::Auto</code></td><td class="topAlign tblval"><code>6</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::Cassette</code></td><td class="topAlign tblval"><code>11</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::Envelope</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::EnvelopeManual</code></td><td class="topAlign tblval"><code>5</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::FormSource</code></td><td class="topAlign tblval"><code>12</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::LargeCapacity</code></td><td class="topAlign tblval"><code>10</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::LargeFormat</code></td><td class="topAlign tblval"><code>9</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::Lower</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::MaxPageSource</code></td><td class="topAlign tblval"><code>13</code></td><td class="topAlign">Deprecated, use LastPaperSource instead</td></tr>
<tr><td class="topAlign"><code>QPrinter::Middle</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::Manual</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::OnlyOne</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::Tractor</code></td><td class="topAlign tblval"><code>7</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::SmallFormat</code></td><td class="topAlign tblval"><code>8</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::Upper</code></td><td class="topAlign tblval"><code>OnlyOne</code></td><td class="topAlign">&nbsp;</td></tr>
<tr><td class="topAlign"><code>QPrinter::CustomSource</code></td><td class="topAlign tblval"><code>14</code></td><td class="topAlign">A PaperSource defined by the printer that is unknown to Qt</td></tr>
<tr><td class="topAlign"><code>QPrinter::LastPaperSource</code></td><td class="topAlign tblval"><code>CustomSource</code></td><td class="topAlign">The highest valid PaperSource value, currently CustomSource</td></tr>
</table></div>
<!-- @@@PaperSource -->
<!-- $$$PrintRange$$$AllPages$$$Selection$$$PageRange$$$CurrentPage -->
<h3 class="fn" id="PrintRange-enum"><a name="PrintRange-enum"></a>enum QPrinter::<span class="name">PrintRange</span></h3>
<p>Used to specify the print range selection option.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QPrinter::AllPages</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">All pages should be printed.</td></tr>
<tr><td class="topAlign"><code>QPrinter::Selection</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">Only the selection should be printed.</td></tr>
<tr><td class="topAlign"><code>QPrinter::PageRange</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The specified page range should be printed.</td></tr>
<tr><td class="topAlign"><code>QPrinter::CurrentPage</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">Only the current page should be printed.</td></tr>
</table></div>
<p><b>See also </b><a href="qprinter.html#setPrintRange">setPrintRange</a>(), <a href="qprinter.html#printRange">printRange</a>(), and <a href="qabstractprintdialog.html#PrintRange-enum">QAbstractPrintDialog::PrintRange</a>.</p>
<!-- @@@PrintRange -->
<!-- $$$PrinterMode$$$ScreenResolution$$$PrinterResolution$$$HighResolution -->
<h3 class="fn" id="PrinterMode-enum"><a name="PrinterMode-enum"></a>enum QPrinter::<span class="name">PrinterMode</span></h3>
<p>This enum describes the mode the printer should work in. It basically presets a certain resolution and working mode.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QPrinter::ScreenResolution</code></td><td class="topAlign tblval"><code>0</code></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"><code>QPrinter::PrinterResolution</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">This value is deprecated. It is equivalent to ScreenResolution on Unix and HighResolution on Windows and Mac. Due to the difference between ScreenResolution and HighResolution, use of this value may lead to non-portable printer code.</td></tr>
<tr><td class="topAlign"><code>QPrinter::HighResolution</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">On Windows, sets the printer resolution to that defined for the printer in use. For PDF printing, sets the resolution of the PDF driver to 1200 dpi.</td></tr>
</table></div>
<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><!-- @@@PrinterMode -->
<!-- $$$PrinterState$$$Idle$$$Active$$$Aborted$$$Error -->
<h3 class="fn" id="PrinterState-enum"><a name="PrinterState-enum"></a>enum QPrinter::<span class="name">PrinterState</span></h3>
<div class="table"><table class="valuelist"><tr><th class="tblConst">Constant</th><th class="tblVal">Value</th></tr>
<tr><td class="topAlign"><code>QPrinter::Idle</code></td><td class="topAlign tblval"><code>0</code></td></tr>
<tr><td class="topAlign"><code>QPrinter::Active</code></td><td class="topAlign tblval"><code>1</code></td></tr>
<tr><td class="topAlign"><code>QPrinter::Aborted</code></td><td class="topAlign tblval"><code>2</code></td></tr>
<tr><td class="topAlign"><code>QPrinter::Error</code></td><td class="topAlign tblval"><code>3</code></td></tr>
</table></div>
<!-- @@@PrinterState -->
<!-- $$$Unit$$$Millimeter$$$Point$$$Inch$$$Pica$$$Didot$$$Cicero$$$DevicePixel -->
<h3 class="fn" id="Unit-enum"><a name="Unit-enum"></a>enum QPrinter::<span class="name">Unit</span></h3>
<p>This enum type is used to specify the measurement unit for page and paper sizes.</p>
<div class="table"><table class="valuelist"><tr><th class="tblConst">Constant</th><th class="tblVal">Value</th></tr>
<tr><td class="topAlign"><code>QPrinter::Millimeter</code></td><td class="topAlign tblval"><code>0</code></td></tr>
<tr><td class="topAlign"><code>QPrinter::Point</code></td><td class="topAlign tblval"><code>1</code></td></tr>
<tr><td class="topAlign"><code>QPrinter::Inch</code></td><td class="topAlign tblval"><code>2</code></td></tr>
<tr><td class="topAlign"><code>QPrinter::Pica</code></td><td class="topAlign tblval"><code>3</code></td></tr>
<tr><td class="topAlign"><code>QPrinter::Didot</code></td><td class="topAlign tblval"><code>4</code></td></tr>
<tr><td class="topAlign"><code>QPrinter::Cicero</code></td><td class="topAlign tblval"><code>5</code></td></tr>
<tr><td class="topAlign"><code>QPrinter::DevicePixel</code></td><td class="topAlign tblval"><code>6</code></td></tr>
</table></div>
<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>
<!-- @@@Unit -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QPrinter[overload1]$$$QPrinterQPrinter::PrinterMode -->
<h3 class="fn" id="QPrinter"><a name="QPrinter"></a>QPrinter::<span class="name">QPrinter</span>(<span class="type"><a href="qprinter.html#PrinterMode-enum">QPrinter::PrinterMode</a></span> <i>mode</i> = ScreenResolution)</h3>
<p>Creates a new printer object with the given <i>mode</i>.</p>
<!-- @@@QPrinter -->
<!-- $$$QPrinter$$$QPrinterconstQPrinterInfo&QPrinter::PrinterMode -->
<h3 class="fn" id="QPrinter-1"><a name="QPrinter-1"></a>QPrinter::<span class="name">QPrinter</span>(const <span class="type"><a href="qprinterinfo.html">QPrinterInfo</a></span> &amp;<i>printer</i>, <span class="type"><a href="qprinter.html#PrinterMode-enum">QPrinter::PrinterMode</a></span> <i>mode</i> = 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>
<!-- @@@QPrinter -->
<!-- $$$~QPrinter[overload1]$$$~QPrinter -->
<h3 class="fn" id="dtor.QPrinter"><a name="dtor.QPrinter"></a><code>[virtual] </code>QPrinter::<span class="name">~QPrinter</span>()</h3>
<p>Destroys the printer object and frees any allocated resources. If the printer is destroyed while a print job is in progress this may or may not affect the print job.</p>
<!-- @@@~QPrinter -->
<!-- $$$abort[overload1]$$$abort -->
<h3 class="fn" id="abort"><a name="abort"></a><span class="type">bool</span> QPrinter::<span class="name">abort</span>()</h3>
<p>Aborts the current print run. Returns <code>true</code> 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 <code>false</code>.</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>
<!-- @@@abort -->
<!-- $$$collateCopies[overload1]$$$collateCopies -->
<h3 class="fn" id="collateCopies"><a name="collateCopies"></a><span class="type">bool</span> QPrinter::<span class="name">collateCopies</span>() const</h3>
<p>Returns <code>true</code> if collation is turned on when multiple copies is selected. Returns <code>false</code> 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 numCopies() 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>
<!-- @@@collateCopies -->
<!-- $$$colorMode[overload1]$$$colorMode -->
<h3 class="fn" id="colorMode"><a name="colorMode"></a><span class="type"><a href="qprinter.html#ColorMode-enum">QPrinter::ColorMode</a></span> QPrinter::<span class="name">colorMode</span>() const</h3>
<p>Returns the current color mode.</p>
<p><b>See also </b><a href="qprinter.html#setColorMode">setColorMode</a>().</p>
<!-- @@@colorMode -->
<!-- $$$copyCount[overload1]$$$copyCount -->
<h3 class="fn" id="copyCount"><a name="copyCount"></a><span class="type">int</span> QPrinter::<span class="name">copyCount</span>() const</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>
<!-- @@@copyCount -->
<!-- $$$creator[overload1]$$$creator -->
<h3 class="fn" id="creator"><a name="creator"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QPrinter::<span class="name">creator</span>() const</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>
<!-- @@@creator -->
<!-- $$$docName[overload1]$$$docName -->
<h3 class="fn" id="docName"><a name="docName"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QPrinter::<span class="name">docName</span>() const</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>
<!-- @@@docName -->
<!-- $$$duplex[overload1]$$$duplex -->
<h3 class="fn" id="duplex"><a name="duplex"></a><span class="type"><a href="qprinter.html#DuplexMode-enum">QPrinter::DuplexMode</a></span> QPrinter::<span class="name">duplex</span>() const</h3>
<p>Returns the current duplex mode.</p>
<p>This function was introduced in  Qt 4.4.</p>
<p><b>See also </b><a href="qprinter.html#setDuplex">setDuplex</a>().</p>
<!-- @@@duplex -->
<!-- $$$fontEmbeddingEnabled[overload1]$$$fontEmbeddingEnabled -->
<h3 class="fn" id="fontEmbeddingEnabled"><a name="fontEmbeddingEnabled"></a><span class="type">bool</span> QPrinter::<span class="name">fontEmbeddingEnabled</span>() const</h3>
<p>Returns <code>true</code> if font embedding is enabled.</p>
<p>This function was introduced in  Qt 4.1.</p>
<p><b>See also </b><a href="qprinter.html#setFontEmbeddingEnabled">setFontEmbeddingEnabled</a>().</p>
<!-- @@@fontEmbeddingEnabled -->
<!-- $$$fromPage[overload1]$$$fromPage -->
<h3 class="fn" id="fromPage"><a name="fromPage"></a><span class="type">int</span> QPrinter::<span class="name">fromPage</span>() const</h3>
<p>Returns the number of the first page in a range of pages to be printed (the &quot;from page&quot; 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 &quot;from page&quot; 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>
<!-- @@@fromPage -->
<!-- $$$fullPage[overload1]$$$fullPage -->
<h3 class="fn" id="fullPage"><a name="fullPage"></a><span class="type">bool</span> QPrinter::<span class="name">fullPage</span>() const</h3>
<p>Returns <code>true</code> 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#pageLayout">pageLayout</a>().</p>
<!-- @@@fullPage -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn" id="isValid"><a name="isValid"></a><span class="type">bool</span> QPrinter::<span class="name">isValid</span>() const</h3>
<p>Returns <code>true</code> if the printer currently selected is a valid printer in the system, or a pure PDF printer; otherwise returns <code>false</code>.</p>
<p>To detect other failures check the output of <a href="../qtgui/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">QPrinter</a></span> printer;
      printer<span class="operator">.</span>setOutputFormat(<span class="type"><a href="qprinter.html#QPrinter">QPrinter</a></span><span class="operator">::</span>PdfFormat);
      printer<span class="operator">.</span>setOutputFileName(<span class="string">&quot;/foobar/nonwritable.pdf&quot;</span>);
      <span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span> painter;
      <span class="keyword">if</span> (<span class="operator">!</span> painter<span class="operator">.</span>begin(<span class="operator">&amp;</span>printer)) { <span class="comment">// failed to open file</span>
          <a href="../qtcore/qtglobal.html#qWarning">qWarning</a>(<span class="string">&quot;failed to open file, is it writable?&quot;</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">&quot;Test&quot;</span>);
      <span class="keyword">if</span> (<span class="operator">!</span> printer<span class="operator">.</span>newPage()) {
          <a href="../qtcore/qtglobal.html#qWarning">qWarning</a>(<span class="string">&quot;failed in flushing page to disk, disk full?&quot;</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">&quot;Test 2&quot;</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>
<!-- @@@isValid -->
<!-- $$$newPage[overload1]$$$newPage -->
<h3 class="fn" id="newPage"><a name="newPage"></a><code>[override virtual] </code><span class="type">bool</span> QPrinter::<span class="name">newPage</span>()</h3>
<p>Reimplemented from <a href="../qtgui/qpagedpaintdevice.html#newPage">QPagedPaintDevice::newPage</a>().</p>
<p>Tells the printer to eject the current page and to continue printing on a new page. Returns <code>true</code> if this was successful; otherwise returns <code>false</code>.</p>
<p>Calling newPage() on an inactive <a href="qprinter.html">QPrinter</a> object will always fail.</p>
<!-- @@@newPage -->
<!-- $$$outputFileName[overload1]$$$outputFileName -->
<h3 class="fn" id="outputFileName"><a name="outputFileName"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QPrinter::<span class="name">outputFileName</span>() const</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>
<!-- @@@outputFileName -->
<!-- $$$outputFormat[overload1]$$$outputFormat -->
<h3 class="fn" id="outputFormat"><a name="outputFormat"></a><span class="type"><a href="qprinter.html#OutputFormat-enum">QPrinter::OutputFormat</a></span> QPrinter::<span class="name">outputFormat</span>() const</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>
<!-- @@@outputFormat -->
<!-- $$$pageLayout[overload1]$$$pageLayout -->
<h3 class="fn" id="pageLayout"><a name="pageLayout"></a><span class="type"><a href="../qtgui/qpagelayout.html">QPageLayout</a></span> QPrinter::<span class="name">pageLayout</span>() const</h3>
<p>Returns the current page layout. Use this method to access the current <a href="../qtgui/qpagesize.html">QPageSize</a>, <a href="../qtgui/qpagelayout.html#Orientation-enum">QPageLayout::Orientation</a>, <a href="../qtcore/qmarginsf.html">QMarginsF</a>, fullPageRect() and paintRect().</p>
<p>Note that you cannot use the setters on the returned object, you must either call the <a href="qprinter.html">QPrinter</a> methods or <a href="qprinter.html#setPageLayout">setPageLayout</a>().</p>
<p>This function was introduced in  Qt 5.3.</p>
<p><b>See also </b><a href="qprinter.html#setPageLayout">setPageLayout</a>(), <a href="qprinter.html#setPageSize">setPageSize</a>(), <a href="qprinter.html#setPageOrientation">setPageOrientation</a>(), and <a href="qprinter.html#setPageMargins">setPageMargins</a>().</p>
<!-- @@@pageLayout -->
<!-- $$$pageOrder[overload1]$$$pageOrder -->
<h3 class="fn" id="pageOrder"><a name="pageOrder"></a><span class="type"><a href="qprinter.html#PageOrder-enum">QPrinter::PageOrder</a></span> QPrinter::<span class="name">pageOrder</span>() const</h3>
<p>Returns the current page order.</p>
<p>The default page order is <code>FirstPageFirst</code>.</p>
<p><b>See also </b><a href="qprinter.html#setPageOrder">setPageOrder</a>().</p>
<!-- @@@pageOrder -->
<!-- $$$pageRect[overload1]$$$pageRectQPrinter::Unit -->
<h3 class="fn" id="pageRect"><a name="pageRect"></a><span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> QPrinter::<span class="name">pageRect</span>(<span class="type"><a href="qprinter.html#Unit-enum">QPrinter::Unit</a></span> <i>unit</i>) const</h3>
<p>Returns the page's rectangle in <i>unit</i>; this is usually smaller than the paperRect() 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-obsolete.html#paperSize">paperSize</a>().</p>
<!-- @@@pageRect -->
<!-- $$$paintEngine[overload1]$$$paintEngine -->
<h3 class="fn" id="paintEngine"><a name="paintEngine"></a><code>[override virtual] </code><span class="type"><a href="../qtgui/qpaintengine.html">QPaintEngine</a></span> *QPrinter::<span class="name">paintEngine</span>() const</h3>
<p>Reimplemented from <a href="../qtgui/qpaintdevice.html#paintEngine">QPaintDevice::paintEngine</a>().</p>
<p>Returns the paint engine used by the printer.</p>
<!-- @@@paintEngine -->
<!-- $$$paperRect[overload1]$$$paperRectQPrinter::Unit -->
<h3 class="fn" id="paperRect"><a name="paperRect"></a><span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> QPrinter::<span class="name">paperRect</span>(<span class="type"><a href="qprinter.html#Unit-enum">QPrinter::Unit</a></span> <i>unit</i>) const</h3>
<p>Returns the paper's rectangle in <i>unit</i>; this is usually larger than the pageRect().</p>
<p>This function was introduced in  Qt 4.4.</p>
<p><b>See also </b><a href="qprinter-obsolete.html#pageRect-1">pageRect</a>().</p>
<!-- @@@paperRect -->
<!-- $$$paperSource[overload1]$$$paperSource -->
<h3 class="fn" id="paperSource"><a name="paperSource"></a><span class="type"><a href="qprinter.html#PaperSource-enum">QPrinter::PaperSource</a></span> QPrinter::<span class="name">paperSource</span>() const</h3>
<p>Returns the printer's paper source. This is <code>Manual</code> or a printer tray or paper cassette.</p>
<p><b>See also </b><a href="qprinter.html#setPaperSource">setPaperSource</a>().</p>
<!-- @@@paperSource -->
<!-- $$$pdfVersion[overload1]$$$pdfVersion -->
<h3 class="fn" id="pdfVersion"><a name="pdfVersion"></a><span class="type"><a href="../qtgui/qpagedpaintdevice.html#PdfVersion-enum">QPagedPaintDevice::PdfVersion</a></span> QPrinter::<span class="name">pdfVersion</span>() const</h3>
<p>Returns the PDF version for this printer. The default is <code>PdfVersion_1_4</code>.</p>
<p>This function was introduced in  Qt 5.10.</p>
<p><b>See also </b><a href="qprinter.html#setPdfVersion">setPdfVersion</a>().</p>
<!-- @@@pdfVersion -->
<!-- $$$printEngine[overload1]$$$printEngine -->
<h3 class="fn" id="printEngine"><a name="printEngine"></a><span class="type"><a href="qprintengine.html">QPrintEngine</a></span> *QPrinter::<span class="name">printEngine</span>() const</h3>
<p>Returns the print engine used by the printer.</p>
<p>This function was introduced in  Qt 4.1.</p>
<!-- @@@printEngine -->
<!-- $$$printProgram[overload1]$$$printProgram -->
<h3 class="fn" id="printProgram"><a name="printProgram"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QPrinter::<span class="name">printProgram</span>() const</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>
<!-- @@@printProgram -->
<!-- $$$printRange[overload1]$$$printRange -->
<h3 class="fn" id="printRange"><a name="printRange"></a><span class="type"><a href="qprinter.html#PrintRange-enum">QPrinter::PrintRange</a></span> QPrinter::<span class="name">printRange</span>() const</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>
<!-- @@@printRange -->
<!-- $$$printerName[overload1]$$$printerName -->
<h3 class="fn" id="printerName"><a name="printerName"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QPrinter::<span class="name">printerName</span>() const</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>
<!-- @@@printerName -->
<!-- $$$printerSelectionOption[overload1]$$$printerSelectionOption -->
<h3 class="fn" id="printerSelectionOption"><a name="printerSelectionOption"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QPrinter::<span class="name">printerSelectionOption</span>() const</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>This function always returns an empty string on Windows and Mac.</p>
<p><b>See also </b><a href="qprinter.html#setPrinterSelectionOption">setPrinterSelectionOption</a>() and <a href="qprinter.html#setPrintProgram">setPrintProgram</a>().</p>
<!-- @@@printerSelectionOption -->
<!-- $$$printerState[overload1]$$$printerState -->
<h3 class="fn" id="printerState"><a name="printerState"></a><span class="type"><a href="qprinter.html#PrinterState-enum">QPrinter::PrinterState</a></span> QPrinter::<span class="name">printerState</span>() const</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>
<!-- @@@printerState -->
<!-- $$$resolution[overload1]$$$resolution -->
<h3 class="fn" id="resolution"><a name="resolution"></a><span class="type">int</span> QPrinter::<span class="name">resolution</span>() const</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>
<!-- @@@resolution -->
<!-- $$$setCollateCopies[overload1]$$$setCollateCopiesbool -->
<h3 class="fn" id="setCollateCopies"><a name="setCollateCopies"></a><span class="type">void</span> QPrinter::<span class="name">setCollateCopies</span>(<span class="type">bool</span> <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 setCollateCopiesEnabled(). 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>
<!-- @@@setCollateCopies -->
<!-- $$$setColorMode[overload1]$$$setColorModeQPrinter::ColorMode -->
<h3 class="fn" id="setColorMode"><a name="setColorMode"></a><span class="type">void</span> QPrinter::<span class="name">setColorMode</span>(<span class="type"><a href="qprinter.html#ColorMode-enum">QPrinter::ColorMode</a></span> <i>newColorMode</i>)</h3>
<p>Sets the printer's color mode to <i>newColorMode</i>, which can be either <code>Color</code> or <code>GrayScale</code>.</p>
<p><b>See also </b><a href="qprinter.html#colorMode">colorMode</a>().</p>
<!-- @@@setColorMode -->
<!-- $$$setCopyCount[overload1]$$$setCopyCountint -->
<h3 class="fn" id="setCopyCount"><a name="setCopyCount"></a><span class="type">void</span> QPrinter::<span class="name">setCopyCount</span>(<span class="type">int</span> <i>count</i>)</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>
<!-- @@@setCopyCount -->
<!-- $$$setCreator[overload1]$$$setCreatorconstQString& -->
<h3 class="fn" id="setCreator"><a name="setCreator"></a><span class="type">void</span> QPrinter::<span class="name">setCreator</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>creator</i>)</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 &quot;Qt&quot; followed by some version number.</p>
<p><b>See also </b><a href="qprinter.html#creator">creator</a>().</p>
<!-- @@@setCreator -->
<!-- $$$setDocName[overload1]$$$setDocNameconstQString& -->
<h3 class="fn" id="setDocName"><a name="setDocName"></a><span class="type">void</span> QPrinter::<span class="name">setDocName</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>name</i>)</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>
<!-- @@@setDocName -->
<!-- $$$setDuplex[overload1]$$$setDuplexQPrinter::DuplexMode -->
<h3 class="fn" id="setDuplex"><a name="setDuplex"></a><span class="type">void</span> QPrinter::<span class="name">setDuplex</span>(<span class="type"><a href="qprinter.html#DuplexMode-enum">QPrinter::DuplexMode</a></span> <i>duplex</i>)</h3>
<p>Enables double sided printing based on the <i>duplex</i> mode.</p>
<p>This function was introduced in  Qt 4.4.</p>
<p><b>See also </b><a href="qprinter.html#duplex">duplex</a>().</p>
<!-- @@@setDuplex -->
<!-- $$$setEngines[overload1]$$$setEnginesQPrintEngine*QPaintEngine* -->
<h3 class="fn" id="setEngines"><a name="setEngines"></a><code>[protected] </code><span class="type">void</span> QPrinter::<span class="name">setEngines</span>(<span class="type"><a href="qprintengine.html">QPrintEngine</a></span> *<i>printEngine</i>, <span class="type"><a href="../qtgui/qpaintengine.html">QPaintEngine</a></span> *<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>
<!-- @@@setEngines -->
<!-- $$$setFontEmbeddingEnabled[overload1]$$$setFontEmbeddingEnabledbool -->
<h3 class="fn" id="setFontEmbeddingEnabled"><a name="setFontEmbeddingEnabled"></a><span class="type">void</span> QPrinter::<span class="name">setFontEmbeddingEnabled</span>(<span class="type">bool</span> <i>enable</i>)</h3>
<p>Enabled or disables font embedding depending on <i>enable</i>.</p>
<p>This function was introduced in  Qt 4.1.</p>
<p><b>See also </b><a href="qprinter.html#fontEmbeddingEnabled">fontEmbeddingEnabled</a>().</p>
<!-- @@@setFontEmbeddingEnabled -->
<!-- $$$setFromTo[overload1]$$$setFromTointint -->
<h3 class="fn" id="setFromTo"><a name="setFromTo"></a><span class="type">void</span> QPrinter::<span class="name">setFromTo</span>(<span class="type">int</span> <i>from</i>, <span class="type">int</span> <i>to</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 setup().</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>
<!-- @@@setFromTo -->
<!-- $$$setFullPage[overload1]$$$setFullPagebool -->
<h3 class="fn" id="setFullPage"><a name="setFullPage"></a><span class="type">void</span> QPrinter::<span class="name">setFullPage</span>(<span class="type">bool</span> <i>fp</i>)</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="../qtgui/qpaintdevice.html#PaintDeviceMetric-enum">device metrics</a> will report the exact same dimensions as indicated by <a href="qprinter.html#PaperSize-typedef">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#pageLayout">pageLayout</a>(), <a href="qprinter.html#setPageSize">setPageSize</a>(), <a href="../qtgui/qpaintdevice.html#width">width</a>(), and <a href="../qtgui/qpaintdevice.html#height">height</a>().</p>
<!-- @@@setFullPage -->
<!-- $$$setOutputFileName[overload1]$$$setOutputFileNameconstQString& -->
<h3 class="fn" id="setOutputFileName"><a name="setOutputFileName"></a><span class="type">void</span> QPrinter::<span class="name">setOutputFileName</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>fileName</i>)</h3>
<p>Sets the name of the output file to <i>fileName</i>.</p>
<p>Setting a null or empty name (0 or &quot;&quot;) 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 &quot;.pdf&quot; suffix PDF is generated. If the file name has a suffix other than &quot;.pdf&quot;, 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 PDF print engines respectively. If you can produce this format natively, for example macOS 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>() and <a href="qprinter.html#setOutputFormat">setOutputFormat</a>().</p>
<!-- @@@setOutputFileName -->
<!-- $$$setOutputFormat[overload1]$$$setOutputFormatQPrinter::OutputFormat -->
<h3 class="fn" id="setOutputFormat"><a name="setOutputFormat"></a><span class="type">void</span> QPrinter::<span class="name">setOutputFormat</span>(<span class="type"><a href="qprinter.html#OutputFormat-enum">QPrinter::OutputFormat</a></span> <i>format</i>)</h3>
<p>Sets the output format for this printer to <i>format</i>.</p>
<p>If <i>format</i> is the same value as currently set then no change will be made.</p>
<p>If <i>format</i> is <a href="qprinter.html#OutputFormat-enum">NativeFormat</a> then the <a href="qprinter.html#printerName">printerName</a> will be set to the default printer. If there are no valid printers configured then no change will be made. If you want to set <a href="qprinter.html#OutputFormat-enum">NativeFormat</a> with a specific <a href="qprinter.html#printerName">printerName</a> then use <a href="qprinter.html#setPrinterName">setPrinterName</a>().</p>
<p>This function was introduced in  Qt 4.1.</p>
<p><b>See also </b><a href="qprinter.html#outputFormat">outputFormat</a>() and <a href="qprinter.html#setPrinterName">setPrinterName</a>().</p>
<!-- @@@setOutputFormat -->
<!-- $$$setPageLayout[overload1]$$$setPageLayoutconstQPageLayout& -->
<h3 class="fn" id="setPageLayout"><a name="setPageLayout"></a><span class="type">bool</span> QPrinter::<span class="name">setPageLayout</span>(const <span class="type"><a href="../qtgui/qpagelayout.html">QPageLayout</a></span> &amp;<i>newLayout</i>)</h3>
<p>Sets the page layout to <i>newLayout</i>.</p>
<p>If the <i>newLayout</i> is not valid for the current printer then the page layout will not be changed. For example, if the page size is not supported by the printer, or if the margins fall outside the printable area.</p>
<p>Returns true if the page layout was successfully set to <i>newLayout</i>.</p>
<p>This function was introduced in  Qt 5.3.</p>
<p><b>See also </b><a href="qprinter.html#pageLayout">pageLayout</a>(), <a href="qprinter.html#setPageSize">setPageSize</a>(), <a href="qprinter.html#setPageOrientation">setPageOrientation</a>(), and <a href="qprinter.html#setPageMargins">setPageMargins</a>().</p>
<!-- @@@setPageLayout -->
<!-- $$$setPageMargins[overload1]$$$setPageMarginsconstQMarginsF& -->
<h3 class="fn" id="setPageMargins"><a name="setPageMargins"></a><span class="type">bool</span> QPrinter::<span class="name">setPageMargins</span>(const <span class="type"><a href="../qtcore/qmarginsf.html">QMarginsF</a></span> &amp;<i>margins</i>)</h3>
<p>Set the page margins to <i>margins</i> using the current units. Returns <code>true</code> if the page margins were set successfully.</p>
<p><b>See also </b><a href="qprinter.html#pageLayout">pageLayout</a>() and <a href="qprinter.html#setPageLayout">setPageLayout</a>().</p>
<!-- @@@setPageMargins -->
<!-- $$$setPageMargins$$$setPageMarginsconstQMarginsF&QPageLayout::Unit -->
<h3 class="fn" id="setPageMargins-1"><a name="setPageMargins-1"></a><span class="type">bool</span> QPrinter::<span class="name">setPageMargins</span>(const <span class="type"><a href="../qtcore/qmarginsf.html">QMarginsF</a></span> &amp;<i>margins</i>, <span class="type"><a href="../qtgui/qpagelayout.html#Unit-enum">QPageLayout::Unit</a></span> <i>units</i>)</h3>
<p>Set the page margins to <i>margins</i> in the given <i>units</i>. If <i>units</i> are not provided then the current units are used.</p>
<p>If in Full Page mode then no check is performed on the <i>margins</i> set, otherwise the <i>margins</i> must fall within the printable area for the page size on the current printer.</p>
<p>To obtain the current page margins use <a href="qprinter.html#pageLayout">pageLayout</a>().pageMargins().</p>
<p>Returns <code>true</code> if the page margins was successfully set to <i>margins</i>.</p>
<p>This function was introduced in  Qt 5.3.</p>
<p><b>See also </b><a href="qprinter.html#pageLayout">pageLayout</a>() and <a href="qprinter.html#setPageLayout">setPageLayout</a>().</p>
<!-- @@@setPageMargins -->
<!-- $$$setPageOrder[overload1]$$$setPageOrderQPrinter::PageOrder -->
<h3 class="fn" id="setPageOrder"><a name="setPageOrder"></a><span class="type">void</span> QPrinter::<span class="name">setPageOrder</span>(<span class="type"><a href="qprinter.html#PageOrder-enum">QPrinter::PageOrder</a></span> <i>pageOrder</i>)</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>
<!-- @@@setPageOrder -->
<!-- $$$setPageOrientation[overload1]$$$setPageOrientationQPageLayout::Orientation -->
<h3 class="fn" id="setPageOrientation"><a name="setPageOrientation"></a><span class="type">bool</span> QPrinter::<span class="name">setPageOrientation</span>(<span class="type"><a href="../qtgui/qpagelayout.html#Orientation-enum">QPageLayout::Orientation</a></span> <i>orientation</i>)</h3>
<p>Sets the page <i>orientation</i> to <a href="../qtgui/qpagelayout.html#Orientation-enum">QPageLayout::Portrait</a> or <a href="../qtgui/qpagelayout.html#Orientation-enum">QPageLayout::Landscape</a>.</p>
<p>The printer driver reads this setting and prints the page using the specified orientation.</p>
<p>On Windows and Mac, 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>To obtain the current <a href="../qtgui/qpagelayout.html#Orientation-enum">QPageLayout::Orientation</a> use <a href="qprinter.html#pageLayout">pageLayout</a>().pageOrientation().</p>
<p>Returns true if the page orientation was successfully set to <i>orientation</i>.</p>
<p>This function was introduced in  Qt 5.3.</p>
<p><b>See also </b><a href="qprinter.html#pageLayout">pageLayout</a>() and <a href="qprinter.html#setPageLayout">setPageLayout</a>().</p>
<!-- @@@setPageOrientation -->
<!-- $$$setPageSize[overload1]$$$setPageSizeconstQPageSize& -->
<h3 class="fn" id="setPageSize"><a name="setPageSize"></a><span class="type">bool</span> QPrinter::<span class="name">setPageSize</span>(const <span class="type"><a href="../qtgui/qpagesize.html">QPageSize</a></span> &amp;<i>pageSize</i>)</h3>
<p>Sets the page size to <i>pageSize</i>.</p>
<p>If the <i>pageSize</i> is not valid for the current printer then the page size will not be changed.</p>
<p>Changing the page size may affect the current page margins if they fall outside the printable margins for the new page size on the current printer.</p>
<p>To obtain the current <a href="../qtgui/qpagesize.html">QPageSize</a> use <a href="qprinter.html#pageLayout">pageLayout</a>().pageSize().</p>
<p>Returns true if the page size was successfully set to <i>pageSize</i>.</p>
<p>This function was introduced in  Qt 5.3.</p>
<p><b>See also </b><a href="qprinter-obsolete.html#pageSize">pageSize</a>(), <a href="qprinter.html#pageLayout">pageLayout</a>(), and <a href="qprinter.html#setPageLayout">setPageLayout</a>().</p>
<!-- @@@setPageSize -->
<!-- $$$setPaperSource[overload1]$$$setPaperSourceQPrinter::PaperSource -->
<h3 class="fn" id="setPaperSource"><a name="setPaperSource"></a><span class="type">void</span> QPrinter::<span class="name">setPaperSource</span>(<span class="type"><a href="qprinter.html#PaperSource-enum">QPrinter::PaperSource</a></span> <i>source</i>)</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>
<!-- @@@setPaperSource -->
<!-- $$$setPdfVersion[overload1]$$$setPdfVersionQPagedPaintDevice::PdfVersion -->
<h3 class="fn" id="setPdfVersion"><a name="setPdfVersion"></a><span class="type">void</span> QPrinter::<span class="name">setPdfVersion</span>(<span class="type"><a href="../qtgui/qpagedpaintdevice.html#PdfVersion-enum">QPagedPaintDevice::PdfVersion</a></span> <i>version</i>)</h3>
<p>Sets the PDF version for this printer to <i>version</i>.</p>
<p>If <i>version</i> is the same value as currently set then no change will be made.</p>
<p>This function was introduced in  Qt 5.10.</p>
<p><b>See also </b><a href="qprinter.html#pdfVersion">pdfVersion</a>().</p>
<!-- @@@setPdfVersion -->
<!-- $$$setPrintProgram[overload1]$$$setPrintProgramconstQString& -->
<h3 class="fn" id="setPrintProgram"><a name="setPrintProgram"></a><span class="type">void</span> QPrinter::<span class="name">setPrintProgram</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>printProg</i>)</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 PDF output. On other platforms, it has no effect.</p>
<p><b>See also </b><a href="qprinter.html#printProgram">printProgram</a>().</p>
<!-- @@@setPrintProgram -->
<!-- $$$setPrintRange[overload1]$$$setPrintRangeQPrinter::PrintRange -->
<h3 class="fn" id="setPrintRange"><a name="setPrintRange"></a><span class="type">void</span> QPrinter::<span class="name">setPrintRange</span>(<span class="type"><a href="qprinter.html#PrintRange-enum">QPrinter::PrintRange</a></span> <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>
<!-- @@@setPrintRange -->
<!-- $$$setPrinterName[overload1]$$$setPrinterNameconstQString& -->
<h3 class="fn" id="setPrinterName"><a name="setPrinterName"></a><span class="type">void</span> QPrinter::<span class="name">setPrinterName</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>name</i>)</h3>
<p>Sets the printer name to <i>name</i>.</p>
<p>If the <i>name</i> is empty then the output format will be set to <a href="qprinter.html#OutputFormat-enum">PdfFormat</a>.</p>
<p>If the <i>name</i> is not a valid printer then no change will be made.</p>
<p>If the <i>name</i> is a valid printer then the output format will be set to <a href="qprinter.html#OutputFormat-enum">NativeFormat</a>.</p>
<p><b>See also </b><a href="qprinter.html#printerName">printerName</a>(), <a href="qprinter.html#isValid">isValid</a>(), and <a href="qprinter.html#setOutputFormat">setOutputFormat</a>().</p>
<!-- @@@setPrinterName -->
<!-- $$$setPrinterSelectionOption[overload1]$$$setPrinterSelectionOptionconstQString& -->
<h3 class="fn" id="setPrinterSelectionOption"><a name="setPrinterSelectionOption"></a><span class="type">void</span> QPrinter::<span class="name">setPrinterSelectionOption</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>option</i>)</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>This function has no effect on Windows or Mac.</p>
<p><b>See also </b><a href="qprinter.html#printerSelectionOption">printerSelectionOption</a>() and <a href="qprinter.html#setPrintProgram">setPrintProgram</a>().</p>
<!-- @@@setPrinterSelectionOption -->
<!-- $$$setResolution[overload1]$$$setResolutionint -->
<h3 class="fn" id="setResolution"><a name="setResolution"></a><span class="type">void</span> QPrinter::<span class="name">setResolution</span>(<span class="type">int</span> <i>dpi</i>)</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="../qtgui/qpainter.html#viewport">QPainter::viewport</a>().</p>
<p>This function must be called before <a href="../qtgui/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-obsolete.html#setPaperSize">setPaperSize</a>().</p>
<!-- @@@setResolution -->
<!-- $$$supportedPaperSources[overload1]$$$supportedPaperSources -->
<h3 class="fn" id="supportedPaperSources"><a name="supportedPaperSources"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type"><a href="qprinter.html#PaperSource-enum">QPrinter::PaperSource</a></span>&gt; QPrinter::<span class="name">supportedPaperSources</span>() const</h3>
<p>Returns the supported paper sizes for this printer.</p>
<p>The values will be either a value that matches an entry in the <a href="qprinter.html#PaperSource-enum">QPrinter::PaperSource</a> enum or a driver spesific value. The driver spesific values are greater than the constant DMBIN_USER declared in wingdi.h&#x2e;</p>
<p><b>Warning:</b> This function is only available in windows.</p>
<!-- @@@supportedPaperSources -->
<!-- $$$supportedResolutions[overload1]$$$supportedResolutions -->
<h3 class="fn" id="supportedResolutions"><a name="supportedResolutions"></a><span class="type"><a href="../qtcore/qlist.html">QList</a></span>&lt;<span class="type">int</span>&gt; QPrinter::<span class="name">supportedResolutions</span>() const</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 PDF, this function will always return a one item list containing only the PDF resolution, i.e&#x2e;, 72 (72 dpi -- but see <a href="qprinter.html#PrinterMode-enum">PrinterMode</a>).</p>
<!-- @@@supportedResolutions -->
<!-- $$$supportsMultipleCopies[overload1]$$$supportsMultipleCopies -->
<h3 class="fn" id="supportsMultipleCopies"><a name="supportsMultipleCopies"></a><span class="type">bool</span> QPrinter::<span class="name">supportsMultipleCopies</span>() const</h3>
<p>Returns <code>true</code> 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>
<!-- @@@supportsMultipleCopies -->
<!-- $$$toPage[overload1]$$$toPage -->
<h3 class="fn" id="toPage"><a name="toPage"></a><span class="type">int</span> QPrinter::<span class="name">toPage</span>() const</h3>
<p>Returns the number of the last page in a range of pages to be printed (the &quot;to page&quot; 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 &quot;to page&quot; 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>
<!-- @@@toPage -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>