QPagedPaintDevice Class

The QPagedPaintDevice class is a represents a paintdevice that supports multiple pages. More...

Header: #include <QPagedPaintDevice>
qmake: QT += gui
Inherits: QPaintDevice
Inherited By:

QPdfWriter

Public Types

class Margins
enum PageSize { A0, A1, A2, A3, ..., LastPageSize }
enum PdfVersion { PdfVersion_1_4, PdfVersion_A1b, PdfVersion_1_6 }

Public Functions

virtual ~QPagedPaintDevice()
QPagedPaintDevice::Margins margins() const
virtual bool newPage() = 0
QPageLayout pageLayout() const
QPagedPaintDevice::PageSize pageSize() const
QSizeF pageSizeMM() const
virtual void setMargins(const QPagedPaintDevice::Margins &margins)
bool setPageLayout(const QPageLayout &newPageLayout)
bool setPageMargins(const QMarginsF &margins)
bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units)
bool setPageOrientation(QPageLayout::Orientation orientation)
bool setPageSize(const QPageSize &pageSize)
virtual void setPageSize(QPagedPaintDevice::PageSize size)
virtual void setPageSizeMM(const QSizeF &size)

Protected Variables

QPagedPaintDevicePrivate *d

Additional Inherited Members

Detailed Description

The QPagedPaintDevice class is a represents a paintdevice that supports multiple pages.

Paged paint devices are used to generate output for printing or for formats like PDF. QPdfWriter and QPrinter inherit from it.

Member Type Documentation

enum QPagedPaintDevice::PageSize

This enum type lists the available page sizes as defined in the Postscript PPD standard. These values are duplicated in QPageSize and QPrinter.

The defined sizes are:

ConstantValueDescription
QPagedPaintDevice::A05841 x 1189 mm
QPagedPaintDevice::A16594 x 841 mm
QPagedPaintDevice::A27420 x 594 mm
QPagedPaintDevice::A38297 x 420 mm
QPagedPaintDevice::A40210 x 297 mm, 8.26 x 11.69 inches
QPagedPaintDevice::A59148 x 210 mm
QPagedPaintDevice::A610105 x 148 mm
QPagedPaintDevice::A71174 x 105 mm
QPagedPaintDevice::A81252 x 74 mm
QPagedPaintDevice::A91337 x 52 mm
QPagedPaintDevice::B0141000 x 1414 mm
QPagedPaintDevice::B115707 x 1000 mm
QPagedPaintDevice::B217500 x 707 mm
QPagedPaintDevice::B318353 x 500 mm
QPagedPaintDevice::B419250 x 353 mm
QPagedPaintDevice::B51176 x 250 mm, 6.93 x 9.84 inches
QPagedPaintDevice::B620125 x 176 mm
QPagedPaintDevice::B72188 x 125 mm
QPagedPaintDevice::B82262 x 88 mm
QPagedPaintDevice::B92333 x 62 mm
QPagedPaintDevice::B101631 x 44 mm
QPagedPaintDevice::C5E24163 x 229 mm
QPagedPaintDevice::Comm10E25105 x 241 mm, U.S. Common 10 Envelope
QPagedPaintDevice::DLE26110 x 220 mm
QPagedPaintDevice::Executive47.5 x 10 inches, 190.5 x 254 mm
QPagedPaintDevice::Folio27210 x 330 mm
QPagedPaintDevice::Ledger28431.8 x 279.4 mm
QPagedPaintDevice::Legal38.5 x 14 inches, 215.9 x 355.6 mm
QPagedPaintDevice::Letter28.5 x 11 inches, 215.9 x 279.4 mm
QPagedPaintDevice::Tabloid29279.4 x 431.8 mm
QPagedPaintDevice::Custom30Unknown, or a user defined size.
QPagedPaintDevice::A1031 
QPagedPaintDevice::A3Extra32 
QPagedPaintDevice::A4Extra33 
QPagedPaintDevice::A4Plus34 
QPagedPaintDevice::A4Small35 
QPagedPaintDevice::A5Extra36 
QPagedPaintDevice::B5Extra37 
QPagedPaintDevice::JisB038 
QPagedPaintDevice::JisB139 
QPagedPaintDevice::JisB240 
QPagedPaintDevice::JisB341 
QPagedPaintDevice::JisB442 
QPagedPaintDevice::JisB543 
QPagedPaintDevice::JisB644,
QPagedPaintDevice::JisB745 
QPagedPaintDevice::JisB846 
QPagedPaintDevice::JisB947 
QPagedPaintDevice::JisB1048 
QPagedPaintDevice::AnsiALetter= Letter
QPagedPaintDevice::AnsiBLedger= Ledger
QPagedPaintDevice::AnsiC49 
QPagedPaintDevice::AnsiD50 
QPagedPaintDevice::AnsiE51 
QPagedPaintDevice::LegalExtra52 
QPagedPaintDevice::LetterExtra53 
QPagedPaintDevice::LetterPlus54 
QPagedPaintDevice::LetterSmall55 
QPagedPaintDevice::TabloidExtra56 
QPagedPaintDevice::ArchA57 
QPagedPaintDevice::ArchB58 
QPagedPaintDevice::ArchC59 
QPagedPaintDevice::ArchD60 
QPagedPaintDevice::ArchE61 
QPagedPaintDevice::Imperial7x962 
QPagedPaintDevice::Imperial8x1063 
QPagedPaintDevice::Imperial9x1164 
QPagedPaintDevice::Imperial9x1265 
QPagedPaintDevice::Imperial10x1166 
QPagedPaintDevice::Imperial10x1367 
QPagedPaintDevice::Imperial10x1468 
QPagedPaintDevice::Imperial12x1169 
QPagedPaintDevice::Imperial15x1170 
QPagedPaintDevice::ExecutiveStandard71 
QPagedPaintDevice::Note72 
QPagedPaintDevice::Quarto73 
QPagedPaintDevice::Statement74 
QPagedPaintDevice::SuperA75 
QPagedPaintDevice::SuperB76 
QPagedPaintDevice::Postcard77 
QPagedPaintDevice::DoublePostcard78 
QPagedPaintDevice::Prc16K79 
QPagedPaintDevice::Prc32K80 
QPagedPaintDevice::Prc32KBig81 
QPagedPaintDevice::FanFoldUS82 
QPagedPaintDevice::FanFoldGerman83 
QPagedPaintDevice::FanFoldGermanLegal84 
QPagedPaintDevice::EnvelopeB485 
QPagedPaintDevice::EnvelopeB586 
QPagedPaintDevice::EnvelopeB687 
QPagedPaintDevice::EnvelopeC088 
QPagedPaintDevice::EnvelopeC189 
QPagedPaintDevice::EnvelopeC290 
QPagedPaintDevice::EnvelopeC391 
QPagedPaintDevice::EnvelopeC492 
QPagedPaintDevice::EnvelopeC5C5E= C5E
QPagedPaintDevice::EnvelopeC693 
QPagedPaintDevice::EnvelopeC6594 
QPagedPaintDevice::EnvelopeC795 
QPagedPaintDevice::EnvelopeDLDLE= DLE
QPagedPaintDevice::Envelope996 
QPagedPaintDevice::Envelope10Comm10E= Comm10E
QPagedPaintDevice::Envelope1197 
QPagedPaintDevice::Envelope1298 
QPagedPaintDevice::Envelope1499 
QPagedPaintDevice::EnvelopeMonarch100 
QPagedPaintDevice::EnvelopePersonal101 
QPagedPaintDevice::EnvelopeChou3102 
QPagedPaintDevice::EnvelopeChou4103 
QPagedPaintDevice::EnvelopeInvite104 
QPagedPaintDevice::EnvelopeItalian105 
QPagedPaintDevice::EnvelopeKaku2106 
QPagedPaintDevice::EnvelopeKaku3107 
QPagedPaintDevice::EnvelopePrc1108 
QPagedPaintDevice::EnvelopePrc2109 
QPagedPaintDevice::EnvelopePrc3110 
QPagedPaintDevice::EnvelopePrc4111 
QPagedPaintDevice::EnvelopePrc5112 
QPagedPaintDevice::EnvelopePrc6113 
QPagedPaintDevice::EnvelopePrc7114 
QPagedPaintDevice::EnvelopePrc8115 
QPagedPaintDevice::EnvelopePrc9116 
QPagedPaintDevice::EnvelopePrc10117 
QPagedPaintDevice::EnvelopeYou4118 
QPagedPaintDevice::LastPageSizeEnvelopeYou4= EnvelopeYou4

Due to historic reasons QPageSize::Executive is not the same as the standard Postscript and Windows Executive size, use QPageSize::ExecutiveStandard instead.

The Postscript standard size QPageSize::Folio is different to the Windows DMPAPER_FOLIO size, use the Postscript standard size QPageSize::FanFoldGermanLegal if needed.

enum QPagedPaintDevice::PdfVersion

The PdfVersion enum describes the version of the PDF file that is produced by QPrinter or QPdfWriter.

ConstantValueDescription
QPagedPaintDevice::PdfVersion_1_40A PDF 1.4 compatible document is produced.
QPagedPaintDevice::PdfVersion_A1b1A PDF/A-1b compatible document is produced.
QPagedPaintDevice::PdfVersion_1_62A PDF 1.6 compatible document is produced. This value was added in Qt 5.12.

Member Function Documentation

[virtual] QPagedPaintDevice::~QPagedPaintDevice()

Destroys the object.

QPagedPaintDevice::Margins QPagedPaintDevice::margins() const

Returns the current margins of the paint device. The default is 0.

Margins are specified in millimeters.

See also setMargins().

[pure virtual] bool QPagedPaintDevice::newPage()

Starts a new page. Returns true on success.

QPageLayout QPagedPaintDevice::pageLayout() const

Returns the current page layout. Use this method to access the current QPageSize, QPageLayout::Orientation, QMarginsF, fullRect() and paintRect().

Note that you cannot use the setters on the returned object, you must either call the individual QPagedPaintDevice setters or use setPageLayout().

This function was introduced in Qt 5.3.

See also setPageLayout(), setPageSize(), setPageOrientation(), and setPageMargins().

QPagedPaintDevice::PageSize QPagedPaintDevice::pageSize() const

Returns the currently used page size.

See also setPageSize().

QSizeF QPagedPaintDevice::pageSizeMM() const

Returns the page size in millimeters.

See also setPageSizeMM().

[virtual] void QPagedPaintDevice::setMargins(const QPagedPaintDevice::Margins &margins)

Sets the margins to be used to margins.

Margins are specified in millimeters.

The margins are purely a hint to the drawing method. They don't affect the coordinate system or clipping.

See also margins().

bool QPagedPaintDevice::setPageLayout(const QPageLayout &newPageLayout)

Sets the page layout to newPageLayout.

You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new page layout to a new page. You should not call any painting methods between a call to setPageLayout() and newPage() as the wrong paint metrics may be used.

Returns true if the page layout was successfully set to newPageLayout.

This function was introduced in Qt 5.3.

See also pageLayout().

bool QPagedPaintDevice::setPageMargins(const QMarginsF &margins)

Set the page margins in the current page layout units.

You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new margins to a new page. You should not call any painting methods between a call to setPageMargins() and newPage() as the wrong paint metrics may be used.

To get the current page margins use pageLayout().pageMargins().

Returns true if the page margins were successfully set to margins.

This function was introduced in Qt 5.3.

See also pageLayout().

bool QPagedPaintDevice::setPageMargins(const QMarginsF &margins, QPageLayout::Unit units)

Set the page margins defined in the given units.

You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new margins to a new page. You should not call any painting methods between a call to setPageMargins() and newPage() as the wrong paint metrics may be used.

To get the current page margins use pageLayout().pageMargins().

Returns true if the page margins were successfully set to margins.

This function was introduced in Qt 5.3.

See also pageLayout().

bool QPagedPaintDevice::setPageOrientation(QPageLayout::Orientation orientation)

Sets the page orientation.

The page orientation is used to define the orientation of the page size when obtaining the page rect.

You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new orientation to a new page. You should not call any painting methods between a call to setPageOrientation() and newPage() as the wrong paint metrics may be used.

To get the current QPageLayout::Orientation use pageLayout().pageOrientation().

Returns true if the page orientation was successfully set to orientation.

This function was introduced in Qt 5.3.

See also pageLayout().

bool QPagedPaintDevice::setPageSize(const QPageSize &pageSize)

Sets the page size to pageSize.

To get the current QPageSize use pageLayout().pageSize().

You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new page size to a new page. You should not call any painting methods between a call to setPageSize() and newPage() as the wrong paint metrics may be used.

Returns true if the page size was successfully set to pageSize.

This function was introduced in Qt 5.3.

See also pageSize() and pageLayout().

[virtual] void QPagedPaintDevice::setPageSize(QPagedPaintDevice::PageSize size)

Sets the size of the a page to size.

See also setPageSizeMM().

[virtual] void QPagedPaintDevice::setPageSizeMM(const QSizeF &size)

Sets the page size to size. size is specified in millimeters.

If the size matches a standard QPagedPaintDevice::PageSize then that page size will be used, otherwise QPagedPaintDevice::Custom will be set.

See also pageSizeMM().

© 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. 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.