The multipage module

A MultiPage has no contents itself (but it has a size!), and renders a list of embedded pages.

The MultiPageRenderer has the same interface as an ordinary renderer, but defers rendering to the renderer of the embedded pages.

class MultiPage(renderer=None)[source]

Bases: qpageview.page.AbstractRenderedPage

A special Page that has a list of embedded sub pages.

The sub pages are in the pages attribute, the first one is on top.

The position and size of the embedded pages is set in the updateSize() method, which is inherited from AbstractPage. By default all sub pages are centered in their natural size.

Rotation of sub pages is relative to the MultiPage.

The scalePages instance attribute can be used to multiply the zoomfactor for the sub pages.

The opaquePages instance attribute optimizes some procedures when set to True (i.e. it prevents rendering sub pages that are hidden below others).

By default, only links in the first sub page are handled. Set linksOnlyFirstSubPage to False if you want links in all sub pages.

scalePages = 1.0
opaquePages = True
linksOnlyFirstSubPage = True
renderer = <qpageview.multipage.MultiPageRenderer object>
classmethod createPages(pageLists, renderer=None, pad=<class 'qpageview.page.BlankPage'>)[source]

Yield pages, taking each page from every pageList.

If pad is given and is not None, it is a callable that instantiates blank pages, to pad the shorter pageLists with. In that case, the returned list of pages has the same length as the longest pageList given. If pad is None, the returned list of pages has the same length as the shortest pageList given.

copy(owner=None, matrix=None)[source]

Reimplemented to also copy the sub pages.

updateSize(dpiX, dpiY, zoomFactor)[source]

Reimplemented to also position our sub-pages.

The default implementation of this method zooms the sub pages at the zoom level of the page * self.scalePages.

updatePagePositions()[source]

Called by updateSize(), set the page positions.

The default implementation of this method centers the pages.

visiblePagesAt(rect)[source]

Yield (page, rect) for all subpages.

The rect may be invalid when opaquePages is False. If opaquePages is True, pages outside rect or hidden below others are exclued. The yielded rect is always valid in that case.

printablePagesAt(rect)[source]

Yield (page, matrix) for all subpages that are visible in rect.

If opaquePages is True, excludes pages outside rect or hidden below others. The matrix (QTransform) describes the transformation from the page to the sub page. Rect is in original coordinates, as with the print() method.

print(painter, rect=None, paperColor=None)[source]

Prints our sub pages.

text(rect)[source]

Reimplemented to get text from sub pages.

linksAt(point)[source]

Reimplemented to find links in sub pages.

linksIn(rect)[source]

Reimplemented to find links in sub pages.

linkRect(link)[source]

Reimplemented to get correct area on the page the link belongs to.

class MultiPageDocument(sources=(), renderer=None)[source]

Bases: qpageview.document.MultiSourceDocument

A Document that combines pages from different documents.

pageClass

alias of qpageview.multipage.MultiPage

createPages()[source]

Implement this method to create and yield the pages.

This method is only called once. After altering filename,-s or source,-s, or invalidate(), it is called again.

class MultiPageRenderer(cache=None)[source]

Bases: qpageview.render.AbstractRenderer

A renderer that interfaces with the renderers of the sub pages of a MultiPage.

update(page, device, rect, callback=None)[source]

Reimplemented to check/rerender (if needed) all sub pages.

paint(page, painter, rect, callback=None)[source]

Reimplemented to paint all the sub pages on top of each other.

image(page, rect, dpiX, dpiY, paperColor)[source]

Return a QImage of the specified rectangle, of all images combined.

unschedule(pages, callback)[source]

Reimplemented to unschedule all sub pages.

invalidate(pages)[source]

Reimplemented to invalidate the base and overlay pages.

combine(painter, images)[source]

Paints images on the painter.

Each image is a tuple(QPoint, QPixmap), describing where to draw. The image on top is first, so drawing should start with the last.

class CallBack(origcallable, page)[source]

Bases: object

A wrapper for a callable that is called with the original Page.