You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qt3/doc/html/qprinter.html

759 lines
42 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qprinter.cpp:43 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QPrinter Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QPrinter Class Reference</h1>
<p>The QPrinter class is a paint device that paints on a printer.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qprinter-h.html">qprinter.h</a>&gt;</tt>
<p>Inherits <a href="qpaintdevice.html">QPaintDevice</a>.
<p><a href="qprinter-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#PrinterMode-enum"><b>PrinterMode</b></a> { ScreenResolution, PrinterResolution, HighResolution, Compatible }</li>
<li class=fn><a href="#QPrinter"><b>QPrinter</b></a> ( PrinterMode&nbsp;m = ScreenResolution )</li>
<li class=fn><a href="#~QPrinter"><b>~QPrinter</b></a> ()</li>
<li class=fn>enum <a href="#Orientation-enum"><b>Orientation</b></a> { Portrait, Landscape }</li>
<li class=fn>enum <a href="#PageSize-enum"><b>PageSize</b></a> { A4, B5, Letter, Legal, Executive, A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E, DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom }</li>
<li class=fn>enum <a href="#PageOrder-enum"><b>PageOrder</b></a> { FirstPageFirst, LastPageFirst }</li>
<li class=fn>enum <a href="#ColorMode-enum"><b>ColorMode</b></a> { GrayScale, Color }</li>
<li class=fn>enum <a href="#PaperSource-enum"><b>PaperSource</b></a> { OnlyOne, Lower, Middle, Manual, Envelope, EnvelopeManual, Auto, Tractor, SmallFormat, LargeFormat, LargeCapacity, Cassette, FormSource }</li>
<li class=fn>enum <a href="#PrintRange-enum"><b>PrintRange</b></a> { AllPages, Selection, PageRange }</li>
<li class=fn>enum <a href="#PrinterOption-enum"><b>PrinterOption</b></a> { PrintToFile, PrintSelection, PrintPageRange }</li>
<li class=fn>QString <a href="#printerName"><b>printerName</b></a> () const</li>
<li class=fn>virtual void <a href="#setPrinterName"><b>setPrinterName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;name )</li>
<li class=fn>bool <a href="#outputToFile"><b>outputToFile</b></a> () const</li>
<li class=fn>virtual void <a href="#setOutputToFile"><b>setOutputToFile</b></a> ( bool&nbsp;enable )</li>
<li class=fn>QString <a href="#outputFileName"><b>outputFileName</b></a> () const</li>
<li class=fn>virtual void <a href="#setOutputFileName"><b>setOutputFileName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;fileName )</li>
<li class=fn>QString <a href="#printProgram"><b>printProgram</b></a> () const</li>
<li class=fn>virtual void <a href="#setPrintProgram"><b>setPrintProgram</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;printProg )</li>
<li class=fn>QString <a href="#printerSelectionOption"><b>printerSelectionOption</b></a> () const</li>
<li class=fn>virtual void <a href="#setPrinterSelectionOption"><b>setPrinterSelectionOption</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;option )</li>
<li class=fn>QString <a href="#docName"><b>docName</b></a> () const</li>
<li class=fn>virtual void <a href="#setDocName"><b>setDocName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;name )</li>
<li class=fn>QString <a href="#creator"><b>creator</b></a> () const</li>
<li class=fn>virtual void <a href="#setCreator"><b>setCreator</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;creator )</li>
<li class=fn>Orientation <a href="#orientation"><b>orientation</b></a> () const</li>
<li class=fn>virtual void <a href="#setOrientation"><b>setOrientation</b></a> ( Orientation&nbsp;orientation )</li>
<li class=fn>PageSize <a href="#pageSize"><b>pageSize</b></a> () const</li>
<li class=fn>virtual void <a href="#setPageSize"><b>setPageSize</b></a> ( PageSize&nbsp;newPageSize )</li>
<li class=fn>void <a href="#setWinPageSize"><b>setWinPageSize</b></a> ( short&nbsp;winPageSize )</li>
<li class=fn>short <a href="#winPageSize"><b>winPageSize</b></a> () const</li>
<li class=fn>virtual void <a href="#setPageOrder"><b>setPageOrder</b></a> ( PageOrder&nbsp;newPageOrder )</li>
<li class=fn>PageOrder <a href="#pageOrder"><b>pageOrder</b></a> () const</li>
<li class=fn>virtual void <a href="#setResolution"><b>setResolution</b></a> ( int&nbsp;dpi )</li>
<li class=fn>virtual int <a href="#resolution"><b>resolution</b></a> () const</li>
<li class=fn>virtual void <a href="#setColorMode"><b>setColorMode</b></a> ( ColorMode&nbsp;newColorMode )</li>
<li class=fn>ColorMode <a href="#colorMode"><b>colorMode</b></a> () const</li>
<li class=fn>virtual void <a href="#setFullPage"><b>setFullPage</b></a> ( bool&nbsp;fp )</li>
<li class=fn>bool <a href="#fullPage"><b>fullPage</b></a> () const</li>
<li class=fn>QSize <a href="#margins"><b>margins</b></a> () const</li>
<li class=fn>void <a href="#setMargins"><b>setMargins</b></a> ( uint&nbsp;top, uint&nbsp;left, uint&nbsp;bottom, uint&nbsp;right )</li>
<li class=fn>void <a href="#margins-2"><b>margins</b></a> ( uint&nbsp;*&nbsp;top, uint&nbsp;*&nbsp;left, uint&nbsp;*&nbsp;bottom, uint&nbsp;*&nbsp;right ) const</li>
<li class=fn>int <a href="#fromPage"><b>fromPage</b></a> () const</li>
<li class=fn>int <a href="#toPage"><b>toPage</b></a> () const</li>
<li class=fn>virtual void <a href="#setFromTo"><b>setFromTo</b></a> ( int&nbsp;fromPage, int&nbsp;toPage )</li>
<li class=fn>int <a href="#minPage"><b>minPage</b></a> () const</li>
<li class=fn>int <a href="#maxPage"><b>maxPage</b></a> () const</li>
<li class=fn>virtual void <a href="#setMinMax"><b>setMinMax</b></a> ( int&nbsp;minPage, int&nbsp;maxPage )</li>
<li class=fn>int <a href="#numCopies"><b>numCopies</b></a> () const</li>
<li class=fn>virtual void <a href="#setNumCopies"><b>setNumCopies</b></a> ( int&nbsp;numCopies )</li>
<li class=fn>PrintRange <a href="#printRange"><b>printRange</b></a> () const</li>
<li class=fn>void <a href="#setPrintRange"><b>setPrintRange</b></a> ( PrintRange&nbsp;range )</li>
<li class=fn>bool <a href="#newPage"><b>newPage</b></a> ()</li>
<li class=fn>bool <a href="#abort"><b>abort</b></a> ()</li>
<li class=fn>bool <a href="#aborted"><b>aborted</b></a> () const</li>
<li class=fn>bool <a href="#setup"><b>setup</b></a> ( QWidget&nbsp;*&nbsp;parent = 0 )</li>
<li class=fn>PaperSource <a href="#paperSource"><b>paperSource</b></a> () const</li>
<li class=fn>virtual void <a href="#setPaperSource"><b>setPaperSource</b></a> ( PaperSource&nbsp;source )</li>
<li class=fn>void <a href="#setOptionEnabled"><b>setOptionEnabled</b></a> ( PrinterOption&nbsp;option, bool&nbsp;enable )</li>
<li class=fn>bool <a href="#isOptionEnabled"><b>isOptionEnabled</b></a> ( PrinterOption&nbsp;option )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QPrinter class is a paint device that paints on a printer.
<p>
<p> On Windows it uses the built-in printer drivers. On X11 it
generates postscript and sends that to lpr, lp, or another print
command.
<p> QPrinter is used in much the same way as <a href="qwidget.html">QWidget</a> and <a href="qpixmap.html">QPixmap</a> are
used. The big difference is that you must keep track of the pages.
<p> QPrinter supports a number of settable parameters, most of which
can be changed by the end user when the application calls
<a href="#setup">QPrinter::setup</a>().
<p> The most important parameters are:
<ul>
<li> <a href="#setOrientation">setOrientation</a>() tells QPrinter which page orientation to use (virtual).
<li> <a href="#setPageSize">setPageSize</a>() tells QPrinter what page size to expect from the
printer.
<li> <a href="#setResolution">setResolution</a>() tells QPrinter what resolution you wish the
printer to provide (in dpi).
<li> <a href="#setFullPage">setFullPage</a>() tells QPrinter whether you want to deal with the
full page or just with the part the printer can draw on. The
default is FALSE, so that by default you should be able to paint
on (0,0). If TRUE the origin of the coordinate system will be in
the top left corner of the paper and most probably the printer
will not be able to paint something there due to it's physical
margins.
<li> <a href="#setNumCopies">setNumCopies</a>() tells QPrinter how many copies of the document
it should print.
<li> <a href="#setMinMax">setMinMax</a>() tells QPrinter and QPrintDialog what the allowed
range for <a href="#fromPage">fromPage</a>() and <a href="#toPage">toPage</a>() are.
</ul>
<p> Except where noted, you can only call the set functions before
<a href="#setup">setup</a>(), or between <a href="qpainter.html#end">QPainter::end</a>() and setup(). (Some may take
effect between setup() and begin(), or between begin() and end(),
but that's strictly undocumented and such behaviour may differ
depending on platform.)
<p> There are also some settings that the user sets (through the
printer dialog) and that applications are expected to obey:
<p> <ul>
<p> <li> <a href="#pageOrder">pageOrder</a>() tells the application program whether to print
first-page-first or last-page-first.
<p> <li> <a href="#colorMode">colorMode</a>() tells the application program whether to print in
color or grayscale. (If you print in color and the printer does
not support color, Qt will try to approximate. The document may
take longer to print, but the quality should not be made visibly
poorer.)
<p> <li> fromPage() and toPage() indicate what pages the application
program should print.
<p> <li> <a href="#paperSource">paperSource</a>() tells the application progam which paper source
to print from.
<p> </ul>
<p> You can of course call these functions to establish defaults
before you ask the user through <a href="#setup">QPrinter::setup</a>().
<p> Once you start printing, calling <a href="#newPage">newPage</a>() is essential. You will
probably also need to look at the <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> for the
printer (see the <a href="simple-application.html#printersimple">print
function</a> in the Application walk-through). In previous versions,
paint device metrics were valid only after the QPrinter has been set
up, i.e. after <a href="#setup">setup</a>() has returned successfully. This is no longer
the case and paint device metrics can be requested safely before set up.
<p> If you want to abort the print job, <a href="#abort">abort</a>() will try its best to
stop printing. It may cancel the entire job or just some of it.
<p>
<p> If your current locale converts "," to ".", you will need to set
a locale (via the standard C setlocale() function) that doen't do this
before using QPrinter. The "C" locale works well for this.
<p> The TrueType font embedding for Qt's postscript driver uses code
by David Chappell of Trinity College Computing Center.
<p>
<p> Copyright 1995, Trinity College Computing Center.
Written by David Chappell.
<p> Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that copyright notice and this permission
notice appear in supporting documentation. This software is
provided "as is" without express or implied warranty.
<p> TrueType font support. These functions allow PPR to generate
PostScript fonts from Microsoft compatible TrueType font files.
<p> The functions in this file do most of the work to convert a
TrueType font to a type 3 PostScript font.
<p> Most of the material in this file is derived from a program called
"ttf2ps" which L. S. Ng posted to the usenet news group
"comp.sources.postscript". The author did not provide a copyright
notice or indicate any restrictions on use.
<p> Last revised 11 July 1995.
<p> <p>See also <a href="graphics.html">Graphics Classes</a> and <a href="images.html">Image Processing Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="ColorMode-enum"></a>QPrinter::ColorMode</h3>
<p> This enum type is used to indicate whether QPrinter should print
in color or not.
<ul>
<li><tt>QPrinter::Color</tt> - print in color if available, otherwise in grayscale.
<li><tt>QPrinter::GrayScale</tt> - print in grayscale, even on color printers.
Might be a little faster than <a href="#ColorMode-enum">Color</a>. This is the default.
</ul>
<h3 class=fn><a name="Orientation-enum"></a>QPrinter::Orientation</h3>
<p> This enum type (not to be confused with Qt::Orientation) is used
to specify each page's orientation.
<ul>
<li><tt>QPrinter::Portrait</tt> - the page's height is greater than its width (the
default).
<li><tt>QPrinter::Landscape</tt> - the page's width is greater than its height.
</ul><p> This type interacts with <a href="#PageSize-enum">QPrinter::PageSize</a> and
<a href="#setFullPage">QPrinter::setFullPage</a>() to determine the final size of the page
available to the application.
<h3 class=fn><a name="PageOrder-enum"></a>QPrinter::PageOrder</h3>
<p> This enum type is used by QPrinter to tell the application program
how to print.
<ul>
<li><tt>QPrinter::FirstPageFirst</tt> - the lowest-numbered page should be printed
first.
<li><tt>QPrinter::LastPageFirst</tt> - the highest-numbered page should be printed
first.
</ul>
<h3 class=fn><a name="PageSize-enum"></a>QPrinter::PageSize</h3>
<p> This enum type specifies what paper size QPrinter should use.
QPrinter does not check that the paper size is available; it just
uses this information, together with QPrinter::Orientation and
<a href="#setFullPage">QPrinter::setFullPage</a>(), to determine the printable area (see
<a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a>).
<p> The defined sizes (with <a href="#setFullPage">setFullPage</a>(TRUE)) are:
<ul>
<li><tt>QPrinter::A0</tt> - 841 x 1189 mm This value is not supported on windows.
<li><tt>QPrinter::A1</tt> - 594 x 841 mm This value is not supported on windows.
<li><tt>QPrinter::A2</tt> - 420 x 594 mm
<li><tt>QPrinter::A3</tt> - 297 x 420 mm
<li><tt>QPrinter::A4</tt> - 210 x 297 mm, 8.26 x 11.7 inches
<li><tt>QPrinter::A5</tt> - 148 x 210 mm
<li><tt>QPrinter::A6</tt> - 105 x 148 mm
<li><tt>QPrinter::A7</tt> - 74 x 105 mm
<li><tt>QPrinter::A8</tt> - 52 x 74 mm
<li><tt>QPrinter::A9</tt> - 37 x 52 mm
<li><tt>QPrinter::B0</tt> - 1030 x 1456 mm
<li><tt>QPrinter::B1</tt> - 728 x 1030 mm
<li><tt>QPrinter::B10</tt> - 32 x 45 mm
<li><tt>QPrinter::B2</tt> - 515 x 728 mm
<li><tt>QPrinter::B3</tt> - 364 x 515 mm
<li><tt>QPrinter::B4</tt> - 257 x 364 mm
<li><tt>QPrinter::B5</tt> - 182 x 257 mm, 7.17 x 10.13 inches
<li><tt>QPrinter::B6</tt> - 128 x 182 mm
<li><tt>QPrinter::B7</tt> - 91 x 128 mm
<li><tt>QPrinter::B8</tt> - 64 x 91 mm
<li><tt>QPrinter::B9</tt> - 45 x 64 mm
<li><tt>QPrinter::C5E</tt> - 163 x 229 mm
<li><tt>QPrinter::Comm10E</tt> - 105 x 241 mm, US Common #10 Envelope
<li><tt>QPrinter::DLE</tt> - 110 x 220 mm
<li><tt>QPrinter::Executive</tt> - 7.5 x 10 inches, 191 x 254 mm
<li><tt>QPrinter::Folio</tt> - 210 x 330 mm
<li><tt>QPrinter::Ledger</tt> - 432 x 279 mm
<li><tt>QPrinter::Legal</tt> - 8.5 x 14 inches, 216 x 356 mm
<li><tt>QPrinter::Letter</tt> - 8.5 x 11 inches, 216 x 279 mm
<li><tt>QPrinter::Tabloid</tt> - 279 x 432 mm
<li><tt>QPrinter::Custom</tt>
<li><tt>QPrinter::NPageSize</tt> - (internal)
</ul><p> With <a href="#setFullPage">setFullPage</a>(FALSE) (the default), the metrics will be a bit
smaller; how much depends on the printer in use.
<h3 class=fn><a name="PaperSource-enum"></a>QPrinter::PaperSource</h3>
<p> This enum type specifies what paper source QPrinter is to use.
QPrinter 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> Note: this is currently only implemented for Windows.
<ul>
<li><tt>QPrinter::OnlyOne</tt>
<li><tt>QPrinter::Lower</tt>
<li><tt>QPrinter::Middle</tt>
<li><tt>QPrinter::Manual</tt>
<li><tt>QPrinter::Envelope</tt>
<li><tt>QPrinter::EnvelopeManual</tt>
<li><tt>QPrinter::Auto</tt>
<li><tt>QPrinter::Tractor</tt>
<li><tt>QPrinter::SmallFormat</tt>
<li><tt>QPrinter::LargeFormat</tt>
<li><tt>QPrinter::LargeCapacity</tt>
<li><tt>QPrinter::Cassette</tt>
<li><tt>QPrinter::FormSource</tt>
</ul>
<h3 class=fn><a name="PrintRange-enum"></a>QPrinter::PrintRange</h3>
<p> This enum is used to specify which print range the application
should use to print.
<ul>
<li><tt>QPrinter::AllPages</tt> - All pages should be printed
<li><tt>QPrinter::Selection</tt> - Only the selection should be printed.
<li><tt>QPrinter::PageRange</tt> - From page, to page option.
</ul><p> <p>See also <a href="#setPrintRange">setPrintRange</a>() and <a href="#printRange">printRange</a>().
<h3 class=fn><a name="PrinterMode-enum"></a>QPrinter::PrinterMode</h3>
<p> This enum describes the mode the printer should work in. It
basically presets a certain resolution and working mode.
<ul>
<li><tt>QPrinter::ScreenResolution</tt> - 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.
<li><tt>QPrinter::PrinterResolution</tt> - Use the physical resolution of the
printer on Windows. On Unix, set the postscript resolution to 72
dpi.
<li><tt>QPrinter::HighResolution</tt> - Use printer resolution on windows, set the
resolution of the postscript driver to 600dpi.
<li><tt>QPrinter::Compatible</tt> - Almost the same as PrinterResolution, but keeps
some peculiarities of the Qt 2.x printer driver. This is useful
for applications ported from Qt 2.x to Qt 3.x.
</ul>
<h3 class=fn><a name="PrinterOption-enum"></a>QPrinter::PrinterOption</h3>
<p> This enum describes various printer options that appear in the
printer setup dialog. It is used to enable and disable these
options in the setup dialog.
<ul>
<li><tt>QPrinter::PrintToFile</tt> - Describes if print to file should be enabled.
<li><tt>QPrinter::PrintSelection</tt> - Describes if printing selections should be enabled.
<li><tt>QPrinter::PrintPageRange</tt> - Describes if printing page ranges (from, to) should
be enabled
</ul><p> <p>See also <a href="#setOptionEnabled">setOptionEnabled</a>() and <a href="#isOptionEnabled">isOptionEnabled</a>().
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QPrinter"></a>QPrinter::QPrinter ( <a href="qprinter.html#PrinterMode-enum">PrinterMode</a>&nbsp;m = ScreenResolution )
</h3>
Constructs a printer paint device with mode <em>m</em>.
<p> <p>See also <a href="#PrinterMode-enum">QPrinter::PrinterMode</a>.
<h3 class=fn><a name="~QPrinter"></a>QPrinter::~QPrinter ()
</h3>
Destroys the printer paint device and cleans up.
<h3 class=fn>bool <a name="abort"></a>QPrinter::abort ()
</h3>
Aborts the print job. Returns TRUE if successful; otherwise
returns FALSE.
<p> <p>See also <a href="#aborted">aborted</a>().
<h3 class=fn>bool <a name="aborted"></a>QPrinter::aborted () const
</h3>
Returns TRUE if the print job was aborted; otherwise returns
FALSE.
<p> <p>See also <a href="#abort">abort</a>().
<h3 class=fn><a href="qprinter.html#ColorMode-enum">ColorMode</a> <a name="colorMode"></a>QPrinter::colorMode () const
</h3>
Returns the current color mode. The default color mode is <a href="#ColorMode-enum">Color</a>.
<p> <p>See also <a href="#setColorMode">setColorMode</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="creator"></a>QPrinter::creator () const
</h3>
<p> Returns the name of the application that created the document.
<p> <p>See also <a href="#setCreator">setCreator</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="docName"></a>QPrinter::docName () const
</h3>
<p> Returns the document name.
<p> <p>See also <a href="#setDocName">setDocName</a>().
<h3 class=fn>int <a name="fromPage"></a>QPrinter::fromPage () const
</h3>
<p> Returns the from-page setting. The default value is 0.
<p> If <a href="#fromPage">fromPage</a>() and <a href="#toPage">toPage</a>() both return 0 this signifies 'print the
whole document'.
<p> The programmer is responsible for reading this setting and
printing accordingly.
<p> <p>See also <a href="#setFromTo">setFromTo</a>() and <a href="#toPage">toPage</a>().
<h3 class=fn>bool <a name="fullPage"></a>QPrinter::fullPage () const
</h3>
Returns TRUE if the origin of the printer's coordinate system is
at the corner of the sheet and FALSE if it is at the edge of the
printable area.
<p> See <a href="#setFullPage">setFullPage</a>() for details and caveats.
<p> <p>See also <a href="#setFullPage">setFullPage</a>(), <a href="#PageSize-enum">PageSize</a>, and <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a>.
<h3 class=fn>bool <a name="isOptionEnabled"></a>QPrinter::isOptionEnabled ( <a href="qprinter.html#PrinterOption-enum">PrinterOption</a>&nbsp;option )
</h3>
Returns TRUE if the printer option with identifier <em>option</em> is enabled;
otherwise returns FALSE.
<p> <p>See also <a href="#setOptionEnabled">setOptionEnabled</a>().
<h3 class=fn><a href="qsize.html">QSize</a> <a name="margins"></a>QPrinter::margins () const
</h3>
Returns the width of the left margin and the height of the top
margin of the printer. On Unix, this is a best-effort guess, not
based on perfect knowledge.
<p> If you have called <a href="#setFullPage">setFullPage</a>( TRUE ), <a href="#margins">margins</a>().width() may be
treated as the smallest sane left margin you can use, and
margins().height() as the smallest sane top margin you can
use.
<p> If you have called setFullPage( FALSE ) (this is the default),
margins() is automatically subtracted from the <a href="#pageSize">pageSize</a>() by
QPrinter.
<p> <p>See also <a href="#setFullPage">setFullPage</a>(), <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a>, and <a href="#PageSize-enum">PageSize</a>.
<h3 class=fn>void <a name="margins-2"></a>QPrinter::margins ( uint&nbsp;*&nbsp;top, uint&nbsp;*&nbsp;left, uint&nbsp;*&nbsp;bottom, uint&nbsp;*&nbsp;right ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets <em>top</em>, <em>left</em>, <em>bottom</em> and <em>right</em> to the margins of the
printer. On Unix, this is a best-effort guess, not based on
perfect knowledge.
<p> If you have called <a href="#setFullPage">setFullPage</a>( TRUE ), the four values specify
the smallest sane margins you can use.
<p> If you have called setFullPage( FALSE ) (this is the default),
the margins are automatically subtracted from the <a href="#pageSize">pageSize</a>() by
QPrinter.
<p> <p>See also <a href="#setFullPage">setFullPage</a>(), <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a>, and <a href="#PageSize-enum">PageSize</a>.
<h3 class=fn>int <a name="maxPage"></a>QPrinter::maxPage () const
</h3>
<p> Returns the max-page setting. A user can't choose a higher page
number than <a href="#maxPage">maxPage</a>() when they select a print range. The default
value is 0.
<p> <p>See also <a href="#minPage">minPage</a>(), <a href="#setMinMax">setMinMax</a>(), and <a href="#setFromTo">setFromTo</a>().
<h3 class=fn>int <a name="minPage"></a>QPrinter::minPage () const
</h3>
<p> Returns the min-page setting, i.e. the lowest page number a user
is allowed to choose. The default value is 0.
<p> <p>See also <a href="#maxPage">maxPage</a>(), <a href="#setMinMax">setMinMax</a>(), and <a href="#setFromTo">setFromTo</a>().
<h3 class=fn>bool <a name="newPage"></a>QPrinter::newPage ()
</h3>
Advances to a new page on the printer. Returns TRUE if successful;
otherwise returns FALSE.
<p>Examples: <a href="qaction-application-example.html#x1149">action/application.cpp</a>, <a href="simple-application-example.html#x1567">application/application.cpp</a>, <a href="helpviewer-example.html#x1005">helpviewer/helpwindow.cpp</a>, and <a href="mdi-example.html#x2050">mdi/application.cpp</a>.
<h3 class=fn>int <a name="numCopies"></a>QPrinter::numCopies () const
</h3>
<p> Returns the number of copies to be printed. The default value is 1.
<p> This value will return the number of times the application is
required to print in order to match the number specified in the
printer setup dialog. This has been done since some printer
drivers are not capable of buffering up the copies and the
application in those cases have to make an explicit call to the
print code for each copy.
<p> <p>See also <a href="#setNumCopies">setNumCopies</a>().
<h3 class=fn><a href="qprinter.html#Orientation-enum">Orientation</a> <a name="orientation"></a>QPrinter::orientation () const
</h3>
<p> Returns the orientation setting. The default value is <a href="#Orientation-enum">QPrinter::Portrait</a>.
<p> <p>See also <a href="#setOrientation">setOrientation</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="outputFileName"></a>QPrinter::outputFileName () const
</h3>
<p> Returns the name of the output file. There is no default file
name.
<p> <p>See also <a href="#setOutputFileName">setOutputFileName</a>() and <a href="#setOutputToFile">setOutputToFile</a>().
<h3 class=fn>bool <a name="outputToFile"></a>QPrinter::outputToFile () const
</h3>
<p> Returns TRUE if the output should be written to a file, or FALSE
if the output should be sent directly to the printer. The default
setting is FALSE.
<p> This function is currently only supported under X11 and Mac OS X.
<p> <p>See also <a href="#setOutputToFile">setOutputToFile</a>() and <a href="#setOutputFileName">setOutputFileName</a>().
<h3 class=fn><a href="qprinter.html#PageOrder-enum">PageOrder</a> <a name="pageOrder"></a>QPrinter::pageOrder () const
</h3>
Returns the current page order.
<p> The default page order is <a href="#PageOrder-enum">FirstPageFirst</a>.
<p>Bugs and limitations:
<ul>
<li> This value is not kept in sync with the Windows or Mac OS X printer
dialogs.
</ul>
<h3 class=fn><a href="qprinter.html#PageSize-enum">PageSize</a> <a name="pageSize"></a>QPrinter::pageSize () const
</h3>
<p> Returns the printer page size. The default value is system-dependent.
<p> <p>See also <a href="#setPageSize">setPageSize</a>().
<h3 class=fn><a href="qprinter.html#PaperSource-enum">PaperSource</a> <a name="paperSource"></a>QPrinter::paperSource () const
</h3>
Returns the currently set paper source of the printer.
<p> <p>See also <a href="#setPaperSource">setPaperSource</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="printProgram"></a>QPrinter::printProgram () const
</h3>
<p> Returns the name of the program that sends the print output to the
printer.
<p> The default is to return a null string; meaning that QPrinter 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.
<p> On Windows, this function returns the name of the printer device
driver.
<p> <p>See also <a href="#setPrintProgram">setPrintProgram</a>() and <a href="#setPrinterSelectionOption">setPrinterSelectionOption</a>().
<h3 class=fn><a href="qprinter.html#PrintRange-enum">PrintRange</a> <a name="printRange"></a>QPrinter::printRange () const
</h3>
Returns the PageRange of the QPrinter. After the print setup dialog
has been opened, this function returns the value selected by the user.
<p> <p>See also <a href="#setPrintRange">setPrintRange</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="printerName"></a>QPrinter::printerName () const
</h3>
<p> Returns the printer name. This value is initially set to the name
of the default printer.
<p> <p>See also <a href="#setPrinterName">setPrinterName</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="printerSelectionOption"></a>QPrinter::printerSelectionOption () const
</h3>
Returns the printer options selection string. This is useful only
if the print command has been explicitly set.
<p> The default value (a null string) implies that the printer should
be selected in a system-dependent manner.
<p> Any other value implies that the given value should be used.
<p> <p>See also <a href="#setPrinterSelectionOption">setPrinterSelectionOption</a>().
<h3 class=fn>int <a name="resolution"></a>QPrinter::resolution () const<tt> [virtual]</tt>
</h3>
Returns the current assumed resolution of the printer, as set by
<a href="#setResolution">setResolution</a>() or by the printer subsystem.
<p> <p>See also <a href="#setResolution">setResolution</a>().
<h3 class=fn>void <a name="setColorMode"></a>QPrinter::setColorMode ( <a href="qprinter.html#ColorMode-enum">ColorMode</a>&nbsp;newColorMode )<tt> [virtual]</tt>
</h3>
Sets the printer's color mode to <em>newColorMode</em>, which can be
either <a href="#ColorMode-enum">Color</a> or <a href="#ColorMode-enum">GrayScale</a> (the default).
<p> <p>See also <a href="#colorMode">colorMode</a>().
<h3 class=fn>void <a name="setCreator"></a>QPrinter::setCreator ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;creator )<tt> [virtual]</tt>
</h3>
Sets the name of the application that created the document to <em>creator</em>.
<p> This function is only applicable to the X11 version of Qt. If no
creator name is specified, the creator will be set to "Qt"
followed by some version number.
<p> <p>See also <a href="#creator">creator</a>().
<h3 class=fn>void <a name="setDocName"></a>QPrinter::setDocName ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name )<tt> [virtual]</tt>
</h3>
Sets the document name to <em>name</em>.
<h3 class=fn>void <a name="setFromTo"></a>QPrinter::setFromTo ( int&nbsp;fromPage, int&nbsp;toPage )<tt> [virtual]</tt>
</h3>
Sets the from-page and to-page settings to <em>fromPage</em> and <em>toPage</em> respectively.
<p> The from-page and to-page settings specify what pages to print.
<p> If <a href="#fromPage">fromPage</a>() and <a href="#toPage">toPage</a>() both return 0 this signifies 'print the
whole document'.
<p> This function is useful mostly to set a default value that the
user can override in the print dialog when you call <a href="#setup">setup</a>().
<p> <p>See also <a href="#fromPage">fromPage</a>(), <a href="#toPage">toPage</a>(), <a href="#setMinMax">setMinMax</a>(), and <a href="#setup">setup</a>().
<h3 class=fn>void <a name="setFullPage"></a>QPrinter::setFullPage ( bool&nbsp;fp )<tt> [virtual]</tt>
</h3>
Sets QPrinter to have the origin of the coordinate system at the
top-left corner of the paper if <em>fp</em> is TRUE, or where it thinks
the top-left corner of the printable area is if <em>fp</em> is FALSE.
<p> The default is FALSE. You can (probably) print on (0,0), and
<a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> will report something smaller than the size
indicated by PageSize. (Note that QPrinter may be wrong on Unix
systems - it does not have perfect knowledge of the physical
printer.)
<p> If you set <em>fp</em> to TRUE, QPaintDeviceMetrics will report the
exact same size as indicated by <a href="#PageSize-enum">PageSize</a>, but you cannot print
on all of that - you must take care of the output margins
yourself.
<p> <p>See also <a href="#PageSize-enum">PageSize</a>, <a href="#setPageSize">setPageSize</a>(), <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a>, and <a href="#fullPage">fullPage</a>().
<p>Examples: <a href="qaction-application-example.html#x1150">action/application.cpp</a>, <a href="simple-application-example.html#x1568">application/application.cpp</a>, <a href="helpviewer-example.html#x1006">helpviewer/helpwindow.cpp</a>, and <a href="mdi-example.html#x2051">mdi/application.cpp</a>.
<h3 class=fn>void <a name="setMargins"></a>QPrinter::setMargins ( uint&nbsp;top, uint&nbsp;left, uint&nbsp;bottom, uint&nbsp;right )
</h3>
Sets the printer margins to the sizes specified in <em>top</em>, <em>left</em>,
<em>bottom</em> and <em>right</em>.
<p> This function currently only has an effect on Unix systems.
<p> <p>See also <a href="#margins">margins</a>().
<h3 class=fn>void <a name="setMinMax"></a>QPrinter::setMinMax ( int&nbsp;minPage, int&nbsp;maxPage )<tt> [virtual]</tt>
</h3>
Sets the min-page and max-page settings to <em>minPage</em> and <em>maxPage</em> respectively.
<p> The min-page and max-page restrict the from-page and to-page
settings. When the printer setup dialog appears, the user cannot
select a from page or a to page that are outside the range
specified by min and max pages.
<p> <p>See also <a href="#minPage">minPage</a>(), <a href="#maxPage">maxPage</a>(), <a href="#setFromTo">setFromTo</a>(), and <a href="#setup">setup</a>().
<h3 class=fn>void <a name="setNumCopies"></a>QPrinter::setNumCopies ( int&nbsp;numCopies )<tt> [virtual]</tt>
</h3>
Sets the number of copies to be printed to <em>numCopies</em>.
<p> The printer driver reads this setting and prints the specified
number of copies.
<p> <p>See also <a href="#numCopies">numCopies</a>() and <a href="#setup">setup</a>().
<h3 class=fn>void <a name="setOptionEnabled"></a>QPrinter::setOptionEnabled ( <a href="qprinter.html#PrinterOption-enum">PrinterOption</a>&nbsp;option, bool&nbsp;enable )
</h3>
Enables the printer option with the identifier <em>option</em> if <em>enable</em> is TRUE, and disables option <em>option</em> if <em>enable</em> is FALSE.
<p> <p>See also <a href="#isOptionEnabled">isOptionEnabled</a>().
<h3 class=fn>void <a name="setOrientation"></a>QPrinter::setOrientation ( <a href="qprinter.html#Orientation-enum">Orientation</a>&nbsp;orientation )<tt> [virtual]</tt>
</h3>
Sets the print orientation to <em>orientation</em>.
<p> The orientation can be either <a href="#Orientation-enum">QPrinter::Portrait</a> or <a href="#Orientation-enum">QPrinter::Landscape</a>.
<p> The printer driver reads this setting and prints using the
specified orientation. On Windows this setting won't take effect
until the printer dialog is shown (using <a href="#setup">QPrinter::setup</a>()).
<p> Windows only! This option can be changed while printing and will
take effect from the next call to <a href="#newPage">newPage</a>()
<p> <p>See also <a href="#orientation">orientation</a>().
<h3 class=fn>void <a name="setOutputFileName"></a>QPrinter::setOutputFileName ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;fileName )<tt> [virtual]</tt>
</h3>
Sets the name of the output file to <em>fileName</em>.
<p> Setting a null or empty name (0 or "") disables output to a file,
i.e. calls <a href="#setOutputToFile">setOutputToFile</a>(FALSE). Setting a non-empty name
enables output to a file, i.e. calls setOutputToFile(TRUE).
<p> This function is currently only supported under X11.
<p> <p>See also <a href="#outputFileName">outputFileName</a>() and <a href="#setOutputToFile">setOutputToFile</a>().
<h3 class=fn>void <a name="setOutputToFile"></a>QPrinter::setOutputToFile ( bool&nbsp;enable )<tt> [virtual]</tt>
</h3>
Specifies whether the output should be written to a file or sent
directly to the printer.
<p> Will output to a file if <em>enable</em> is TRUE, or will output
directly to the printer if <em>enable</em> is FALSE.
<p> This function is currently only supported under X11 and Mac OS X.
<p> <p>See also <a href="#outputToFile">outputToFile</a>() and <a href="#setOutputFileName">setOutputFileName</a>().
<h3 class=fn>void <a name="setPageOrder"></a>QPrinter::setPageOrder ( <a href="qprinter.html#PageOrder-enum">PageOrder</a>&nbsp;newPageOrder )<tt> [virtual]</tt>
</h3>
Sets the page order to <em>newPageOrder</em>.
<p> The page order can be <a href="#PageOrder-enum">QPrinter::FirstPageFirst</a> or <a href="#PageOrder-enum">QPrinter::LastPageFirst</a>. The application programmer is responsible
for reading the page order and printing accordingly.
<p> This function is useful mostly for setting a default value that
the user can override in the print dialog when you call <a href="#setup">setup</a>().
<p>Bugs and limitations:
<ul>
<li> This value is not kept in sync with the Windows or Mac OS X printer
dialogs.
</ul>
<h3 class=fn>void <a name="setPageSize"></a>QPrinter::setPageSize ( <a href="qprinter.html#PageSize-enum">PageSize</a>&nbsp;newPageSize )<tt> [virtual]</tt>
</h3>
Sets the printer page size to <em>newPageSize</em> if that size is
supported. The result if undefined if <em>newPageSize</em> is not
supported.
<p> The default page size is system-dependent.
<p> This function is useful mostly for setting a default value that
the user can override in the print dialog when you call <a href="#setup">setup</a>().
<p> <p>See also <a href="#pageSize">pageSize</a>(), <a href="#PageSize-enum">PageSize</a>, <a href="#setFullPage">setFullPage</a>(), and <a href="#setResolution">setResolution</a>().
<h3 class=fn>void <a name="setPaperSource"></a>QPrinter::setPaperSource ( <a href="qprinter.html#PaperSource-enum">PaperSource</a>&nbsp;source )<tt> [virtual]</tt>
</h3>
Sets the paper source setting to <em>source</em>.
<p> Windows only! This option can be changed while printing and will
take effect from the next call to <a href="#newPage">newPage</a>()
<p> <p>See also <a href="#paperSource">paperSource</a>().
<h3 class=fn>void <a name="setPrintProgram"></a>QPrinter::setPrintProgram ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;printProg )<tt> [virtual]</tt>
</h3>
Sets the name of the program that should do the print job to <em>printProg</em>.
<p> On X11, this function sets the program to call with the PostScript
output. On other platforms, it has no effect.
<p> <p>See also <a href="#printProgram">printProgram</a>().
<h3 class=fn>void <a name="setPrintRange"></a>QPrinter::setPrintRange ( <a href="qprinter.html#PrintRange-enum">PrintRange</a>&nbsp;range )
</h3>
Sets the default selected page range to be used when the print setup
dialog is opened to <em>range</em>. If the PageRange specified by <em>range</em> is
currently disabled the function does nothing.
<p> <p>See also <a href="#printRange">printRange</a>().
<h3 class=fn>void <a name="setPrinterName"></a>QPrinter::setPrinterName ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name )<tt> [virtual]</tt>
</h3>
Sets the printer name to <em>name</em>.
<p> The default printer will be used if no printer name is set.
<p> Under X11, the <tt>PRINTER</tt> environment variable defines the default
printer. Under any other window system, the window system defines
the default printer.
<p> <p>See also <a href="#printerName">printerName</a>().
<h3 class=fn>void <a name="setPrinterSelectionOption"></a>QPrinter::setPrinterSelectionOption ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;option )<tt> [virtual]</tt>
</h3>
Sets the printer to use <em>option</em> to select the printer. <em>option</em>
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> If the printer selection option is changed while the printer is
active, the current print job may or may not be affected.
<p> <p>See also <a href="#printerSelectionOption">printerSelectionOption</a>().
<h3 class=fn>void <a name="setResolution"></a>QPrinter::setResolution ( int&nbsp;dpi )<tt> [virtual]</tt>
</h3>
Requests that the printer prints at <em>dpi</em> or as near to <em>dpi</em> as
possible.
<p> This setting affects the coordinate system as returned by, for
example, <a href="qpaintdevicemetrics.html">QPaintDeviceMetrics</a> and <a href="qpainter.html#viewport">QPainter::viewport</a>().
<p> The value depends on the <tt>PrintingMode</tt> used in the QPrinter
constructor. By default, the dpi value of the screen is used.
<p> This function must be called before <a href="#setup">setup</a>() to have an effect on
all platforms.
<p> <p>See also <a href="#resolution">resolution</a>() and <a href="#setPageSize">setPageSize</a>().
<h3 class=fn>void <a name="setWinPageSize"></a>QPrinter::setWinPageSize ( short&nbsp;winPageSize )
</h3>
Windows only, using this function is not portable!
Sets the windows page size value that is used by the <tt>DEVMODE</tt>
struct. The <em>winPageSize</em> value must be one of the DMPAPER_ defines
from wingdi.h.
<h3 class=fn>bool <a name="setup"></a>QPrinter::setup ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0 )
</h3>
Opens a printer setup dialog, with parent <em>parent</em>, and asks the
user to specify which printer they wish to use and what settings
it should have.
<p> Returns TRUE if the user pressed "OK" to print, or FALSE if the
user canceled the operation.
<p>Examples: <a href="qaction-application-example.html#x1151">action/application.cpp</a>, <a href="simple-application-example.html#x1569">application/application.cpp</a>, <a href="drawdemo-example.html#x1079">drawdemo/drawdemo.cpp</a>, <a href="helpviewer-example.html#x1007">helpviewer/helpwindow.cpp</a>, and <a href="mdi-example.html#x2052">mdi/application.cpp</a>.
<h3 class=fn>int <a name="toPage"></a>QPrinter::toPage () const
</h3>
<p> Returns the to-page setting. The default value is 0.
<p> If <a href="#fromPage">fromPage</a>() and <a href="#toPage">toPage</a>() both return 0 this signifies 'print the
whole document'.
<p> The programmer is responsible for reading this setting and
printing accordingly.
<p> <p>See also <a href="#setFromTo">setFromTo</a>() and <a href="#fromPage">fromPage</a>().
<h3 class=fn>short <a name="winPageSize"></a>QPrinter::winPageSize () const
</h3>
Returns the Windows page size value as used by the <tt>DEVMODE</tt>
struct (Windows only). Using this function is not portable.
<p> Use <a href="#pageSize">pageSize</a>() to get the <a href="#PageSize-enum">PageSize</a>, e.g. 'A4', 'Letter', etc.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>