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.
tqt3/doc/html/ntqprinter.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>TQPrinter 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>TQPrinter Class Reference</h1>
<p>The TQPrinter class is a paint device that paints on a printer.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qprinter-h.html">ntqprinter.h</a>&gt;</tt>
<p>Inherits <a href="ntqpaintdevice.html">TQPaintDevice</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="#TQPrinter"><b>TQPrinter</b></a> ( PrinterMode&nbsp;m = ScreenResolution )</li>
<li class=fn><a href="#~TQPrinter"><b>~TQPrinter</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>TQString <a href="#printerName"><b>printerName</b></a> () const</li>
<li class=fn>virtual void <a href="#setPrinterName"><b>setPrinterName</b></a> ( const&nbsp;TQString&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>TQString <a href="#outputFileName"><b>outputFileName</b></a> () const</li>
<li class=fn>virtual void <a href="#setOutputFileName"><b>setOutputFileName</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;fileName )</li>
<li class=fn>TQString <a href="#printProgram"><b>printProgram</b></a> () const</li>
<li class=fn>virtual void <a href="#setPrintProgram"><b>setPrintProgram</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;printProg )</li>
<li class=fn>TQString <a href="#printerSelectionOption"><b>printerSelectionOption</b></a> () const</li>
<li class=fn>virtual void <a href="#setPrinterSelectionOption"><b>setPrinterSelectionOption</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;option )</li>
<li class=fn>TQString <a href="#docName"><b>docName</b></a> () const</li>
<li class=fn>virtual void <a href="#setDocName"><b>setDocName</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;name )</li>
<li class=fn>TQString <a href="#creator"><b>creator</b></a> () const</li>
<li class=fn>virtual void <a href="#setCreator"><b>setCreator</b></a> ( const&nbsp;TQString&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>TQSize <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> ( TQWidget&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 TQPrinter 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> TQPrinter is used in much the same way as <a href="ntqwidget.html">TQWidget</a> and <a href="ntqpixmap.html">TQPixmap</a> are
used. The big difference is that you must keep track of the pages.
<p> TQPrinter supports a number of settable parameters, most of which
can be changed by the end user when the application calls
<a href="#setup">TQPrinter::setup</a>().
<p> The most important parameters are:
<ul>
<li> <a href="#setOrientation">setOrientation</a>() tells TQPrinter which page orientation to use (virtual).
<li> <a href="#setPageSize">setPageSize</a>() tells TQPrinter what page size to expect from the
printer.
<li> <a href="#setResolution">setResolution</a>() tells TQPrinter what resolution you wish the
printer to provide (in dpi).
<li> <a href="#setFullPage">setFullPage</a>() tells TQPrinter 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 TQPrinter how many copies of the document
it should print.
<li> <a href="#setMinMax">setMinMax</a>() tells TQPrinter and TQPrintDialog 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="ntqpainter.html#end">TQPainter::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, TQt 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">TQPrinter::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="ntqpaintdevicemetrics.html">TQPaintDeviceMetrics</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 TQPrinter 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 TQPrinter. The "C" locale works well for this.
<p> The TrueType font embedding for TQt'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>TQPrinter::ColorMode</h3>
<p> This enum type is used to indicate whether TQPrinter should print
in color or not.
<ul>
<li><tt>TQPrinter::Color</tt> - print in color if available, otherwise in grayscale.
<li><tt>TQPrinter::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>TQPrinter::Orientation</h3>
<p> This enum type (not to be confused with TQt::Orientation) is used
to specify each page's orientation.
<ul>
<li><tt>TQPrinter::Portrait</tt> - the page's height is greater than its width (the
default).
<li><tt>TQPrinter::Landscape</tt> - the page's width is greater than its height.
</ul><p> This type interacts with <a href="#PageSize-enum">TQPrinter::PageSize</a> and
<a href="#setFullPage">TQPrinter::setFullPage</a>() to determine the final size of the page
available to the application.
<h3 class=fn><a name="PageOrder-enum"></a>TQPrinter::PageOrder</h3>
<p> This enum type is used by TQPrinter to tell the application program
how to print.
<ul>
<li><tt>TQPrinter::FirstPageFirst</tt> - the lowest-numbered page should be printed
first.
<li><tt>TQPrinter::LastPageFirst</tt> - the highest-numbered page should be printed
first.
</ul>
<h3 class=fn><a name="PageSize-enum"></a>TQPrinter::PageSize</h3>
<p> This enum type specifies what paper size TQPrinter should use.
TQPrinter does not check that the paper size is available; it just
uses this information, together with TQPrinter::Orientation and
<a href="#setFullPage">TQPrinter::setFullPage</a>(), to determine the printable area (see
<a href="ntqpaintdevicemetrics.html">TQPaintDeviceMetrics</a>).
<p> The defined sizes (with <a href="#setFullPage">setFullPage</a>(TRUE)) are:
<ul>
<li><tt>TQPrinter::A0</tt> - 841 x 1189 mm This value is not supported on windows.
<li><tt>TQPrinter::A1</tt> - 594 x 841 mm This value is not supported on windows.
<li><tt>TQPrinter::A2</tt> - 420 x 594 mm
<li><tt>TQPrinter::A3</tt> - 297 x 420 mm
<li><tt>TQPrinter::A4</tt> - 210 x 297 mm, 8.26 x 11.7 inches
<li><tt>TQPrinter::A5</tt> - 148 x 210 mm
<li><tt>TQPrinter::A6</tt> - 105 x 148 mm
<li><tt>TQPrinter::A7</tt> - 74 x 105 mm
<li><tt>TQPrinter::A8</tt> - 52 x 74 mm
<li><tt>TQPrinter::A9</tt> - 37 x 52 mm
<li><tt>TQPrinter::B0</tt> - 1030 x 1456 mm
<li><tt>TQPrinter::B1</tt> - 728 x 1030 mm
<li><tt>TQPrinter::B10</tt> - 32 x 45 mm
<li><tt>TQPrinter::B2</tt> - 515 x 728 mm
<li><tt>TQPrinter::B3</tt> - 364 x 515 mm
<li><tt>TQPrinter::B4</tt> - 257 x 364 mm
<li><tt>TQPrinter::B5</tt> - 182 x 257 mm, 7.17 x 10.13 inches
<li><tt>TQPrinter::B6</tt> - 128 x 182 mm
<li><tt>TQPrinter::B7</tt> - 91 x 128 mm
<li><tt>TQPrinter::B8</tt> - 64 x 91 mm
<li><tt>TQPrinter::B9</tt> - 45 x 64 mm
<li><tt>TQPrinter::C5E</tt> - 163 x 229 mm
<li><tt>TQPrinter::Comm10E</tt> - 105 x 241 mm, US Common #10 Envelope
<li><tt>TQPrinter::DLE</tt> - 110 x 220 mm
<li><tt>TQPrinter::Executive</tt> - 7.5 x 10 inches, 191 x 254 mm
<li><tt>TQPrinter::Folio</tt> - 210 x 330 mm
<li><tt>TQPrinter::Ledger</tt> - 432 x 279 mm
<li><tt>TQPrinter::Legal</tt> - 8.5 x 14 inches, 216 x 356 mm
<li><tt>TQPrinter::Letter</tt> - 8.5 x 11 inches, 216 x 279 mm
<li><tt>TQPrinter::Tabloid</tt> - 279 x 432 mm
<li><tt>TQPrinter::Custom</tt>
<li><tt>TQPrinter::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>TQPrinter::PaperSource</h3>
<p> This enum type specifies what paper source TQPrinter is to use.
TQPrinter 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>TQPrinter::OnlyOne</tt>
<li><tt>TQPrinter::Lower</tt>
<li><tt>TQPrinter::Middle</tt>
<li><tt>TQPrinter::Manual</tt>
<li><tt>TQPrinter::Envelope</tt>
<li><tt>TQPrinter::EnvelopeManual</tt>
<li><tt>TQPrinter::Auto</tt>
<li><tt>TQPrinter::Tractor</tt>
<li><tt>TQPrinter::SmallFormat</tt>
<li><tt>TQPrinter::LargeFormat</tt>
<li><tt>TQPrinter::LargeCapacity</tt>
<li><tt>TQPrinter::Cassette</tt>
<li><tt>TQPrinter::FormSource</tt>
</ul>
<h3 class=fn><a name="PrintRange-enum"></a>TQPrinter::PrintRange</h3>
<p> This enum is used to specify which print range the application
should use to print.
<ul>
<li><tt>TQPrinter::AllPages</tt> - All pages should be printed
<li><tt>TQPrinter::Selection</tt> - Only the selection should be printed.
<li><tt>TQPrinter::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>TQPrinter::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>TQPrinter::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>TQPrinter::PrinterResolution</tt> - Use the physical resolution of the
printer on Windows. On Unix, set the postscript resolution to 72
dpi.
<li><tt>TQPrinter::HighResolution</tt> - Use printer resolution on windows, set the
resolution of the postscript driver to 600dpi.
<li><tt>TQPrinter::Compatible</tt> - Almost the same as PrinterResolution, but keeps
some peculiarities of the TQt 2.x printer driver. This is useful
for applications ported from TQt 2.x to TQt 3.x.
</ul>
<h3 class=fn><a name="PrinterOption-enum"></a>TQPrinter::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>TQPrinter::PrintToFile</tt> - Describes if print to file should be enabled.
<li><tt>TQPrinter::PrintSelection</tt> - Describes if printing selections should be enabled.
<li><tt>TQPrinter::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="TQPrinter"></a>TQPrinter::TQPrinter ( <a href="ntqprinter.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">TQPrinter::PrinterMode</a>.
<h3 class=fn><a name="~TQPrinter"></a>TQPrinter::~TQPrinter ()
</h3>
Destroys the printer paint device and cleans up.
<h3 class=fn>bool <a name="abort"></a>TQPrinter::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>TQPrinter::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="ntqprinter.html#ColorMode-enum">ColorMode</a> <a name="colorMode"></a>TQPrinter::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="ntqstring.html">TQString</a> <a name="creator"></a>TQPrinter::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="ntqstring.html">TQString</a> <a name="docName"></a>TQPrinter::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>TQPrinter::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>TQPrinter::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="ntqpaintdevicemetrics.html">TQPaintDeviceMetrics</a>.
<h3 class=fn>bool <a name="isOptionEnabled"></a>TQPrinter::isOptionEnabled ( <a href="ntqprinter.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="ntqsize.html">TQSize</a> <a name="margins"></a>TQPrinter::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
TQPrinter.
<p> <p>See also <a href="#setFullPage">setFullPage</a>(), <a href="ntqpaintdevicemetrics.html">TQPaintDeviceMetrics</a>, and <a href="#PageSize-enum">PageSize</a>.
<h3 class=fn>void <a name="margins-2"></a>TQPrinter::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
TQPrinter.
<p> <p>See also <a href="#setFullPage">setFullPage</a>(), <a href="ntqpaintdevicemetrics.html">TQPaintDeviceMetrics</a>, and <a href="#PageSize-enum">PageSize</a>.
<h3 class=fn>int <a name="maxPage"></a>TQPrinter::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>TQPrinter::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>TQPrinter::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>TQPrinter::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="ntqprinter.html#Orientation-enum">Orientation</a> <a name="orientation"></a>TQPrinter::orientation () const
</h3>
<p> Returns the orientation setting. The default value is <a href="#Orientation-enum">TQPrinter::Portrait</a>.
<p> <p>See also <a href="#setOrientation">setOrientation</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="outputFileName"></a>TQPrinter::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>TQPrinter::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="ntqprinter.html#PageOrder-enum">PageOrder</a> <a name="pageOrder"></a>TQPrinter::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="ntqprinter.html#PageSize-enum">PageSize</a> <a name="pageSize"></a>TQPrinter::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="ntqprinter.html#PaperSource-enum">PaperSource</a> <a name="paperSource"></a>TQPrinter::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="ntqstring.html">TQString</a> <a name="printProgram"></a>TQPrinter::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 TQPrinter 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="ntqprinter.html#PrintRange-enum">PrintRange</a> <a name="printRange"></a>TQPrinter::printRange () const
</h3>
Returns the PageRange of the TQPrinter. 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="ntqstring.html">TQString</a> <a name="printerName"></a>TQPrinter::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="ntqstring.html">TQString</a> <a name="printerSelectionOption"></a>TQPrinter::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>TQPrinter::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>TQPrinter::setColorMode ( <a href="ntqprinter.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>TQPrinter::setCreator ( const&nbsp;<a href="ntqstring.html">TQString</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 TQt. If no
creator name is specified, the creator will be set to "TQt"
followed by some version number.
<p> <p>See also <a href="#creator">creator</a>().
<h3 class=fn>void <a name="setDocName"></a>TQPrinter::setDocName ( const&nbsp;<a href="ntqstring.html">TQString</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>TQPrinter::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>TQPrinter::setFullPage ( bool&nbsp;fp )<tt> [virtual]</tt>
</h3>
Sets TQPrinter 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="ntqpaintdevicemetrics.html">TQPaintDeviceMetrics</a> will report something smaller than the size
indicated by PageSize. (Note that TQPrinter 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, TQPaintDeviceMetrics 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="ntqpaintdevicemetrics.html">TQPaintDeviceMetrics</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>TQPrinter::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>TQPrinter::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>TQPrinter::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>TQPrinter::setOptionEnabled ( <a href="ntqprinter.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>TQPrinter::setOrientation ( <a href="ntqprinter.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">TQPrinter::Portrait</a> or <a href="#Orientation-enum">TQPrinter::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">TQPrinter::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>TQPrinter::setOutputFileName ( const&nbsp;<a href="ntqstring.html">TQString</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>TQPrinter::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>TQPrinter::setPageOrder ( <a href="ntqprinter.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">TQPrinter::FirstPageFirst</a> or <a href="#PageOrder-enum">TQPrinter::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>TQPrinter::setPageSize ( <a href="ntqprinter.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>TQPrinter::setPaperSource ( <a href="ntqprinter.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>TQPrinter::setPrintProgram ( const&nbsp;<a href="ntqstring.html">TQString</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>TQPrinter::setPrintRange ( <a href="ntqprinter.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>TQPrinter::setPrinterName ( const&nbsp;<a href="ntqstring.html">TQString</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>TQPrinter::setPrinterSelectionOption ( const&nbsp;<a href="ntqstring.html">TQString</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 TQt 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>TQPrinter::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="ntqpaintdevicemetrics.html">TQPaintDeviceMetrics</a> and <a href="ntqpainter.html#viewport">TQPainter::viewport</a>().
<p> The value depends on the <tt>PrintingMode</tt> used in the TQPrinter
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>TQPrinter::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>TQPrinter::setup ( <a href="ntqwidget.html">TQWidget</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>TQPrinter::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>TQPrinter::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">TQt 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>TQt 3.3.8</div>
</table></div></address></body>
</html>