QPagedPaintDevice#

The QPagedPaintDevice class represents a paint device that supports multiple pages. More

Inheritance diagram of PySide6.QtGui.QPagedPaintDevice

Inherited by: QPrinter, QPdfWriter

Synopsis#

Functions#

Virtual functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

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

class PySide6.QtGui.QPagedPaintDevice#
PySide6.QtGui.QPagedPaintDevice.PdfVersion#

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

Constant

Description

QPagedPaintDevice.PdfVersion_1_4

A PDF 1.4 compatible document is produced.

QPagedPaintDevice.PdfVersion_A1b

A PDF/A-1b compatible document is produced.

QPagedPaintDevice.PdfVersion_1_6

A PDF 1.6 compatible document is produced. This value was added in Qt 5.12.

abstract PySide6.QtGui.QPagedPaintDevice.newPage()#
Return type:

bool

Starts a new page. Returns true on success.

PySide6.QtGui.QPagedPaintDevice.pageLayout()#
Return type:

PySide6.QtGui.QPageLayout

Returns the current page layout. Use this method to access the current QPageSize , 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() .

PySide6.QtGui.QPagedPaintDevice.pageRanges()#
Return type:

PySide6.QtGui.QPageRanges

Returns the page ranges associated with this device.

See also

setPageRanges() QPageRanges toPage()

PySide6.QtGui.QPagedPaintDevice.setPageLayout(pageLayout)#
Parameters:

pageLayoutPySide6.QtGui.QPageLayout

Return type:

bool

Sets the page layout to newPageLayout.

You should call this before calling 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.

See also

pageLayout()

PySide6.QtGui.QPagedPaintDevice.setPageMargins(margins[, units=QPageLayout.Millimeter])#
Parameters:
Return type:

bool

Set the page margins defined in the given units.

You should call this before calling 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() .margins().

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

See also

pageLayout()

PySide6.QtGui.QPagedPaintDevice.setPageOrientation(orientation)#
Parameters:

orientationOrientation

Return type:

bool

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 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 Orientation use pageLayout() .orientation().

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

See also

pageLayout()

PySide6.QtGui.QPagedPaintDevice.setPageRanges(ranges)#
Parameters:

rangesPySide6.QtGui.QPageRanges

Sets the page ranges for this device to ranges.

See also

pageRanges()

PySide6.QtGui.QPagedPaintDevice.setPageSize(pageSize)#
Parameters:

pageSizePySide6.QtGui.QPageSize

Return type:

bool

Sets the page size to pageSize.

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

You should call this before calling 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.

See also

pageLayout()