Document (rinoh.document)

class rinoh.document.DocumentTree(flowables, options=None, style=None, source=None)

Holds the document’s contents as a tree of flowables

Parameters:
flowables : list[Flowable]

the list of top-level flowables

options : Reader

frontend-specific options

class rinoh.document.Document(document_tree, stylesheet, language, strings=None, backend=None)

Renders a document tree to pages

Parameters:
document_tree : DocumentTree

a tree of the document’s contents

stylesheet : StyleSheet

style sheet used to style document elements

language : Language

the language to use for standard strings

strings : Strings

user-defined string variables and can override localized strings provided by language

backend=None

the backend used for rendering the document

render(filename_root=None, file=None)

Render the document repeatedly until the output no longer changes due to cross-references that need some iterations to converge.

Pages

class rinoh.document.Page(document_part, number, paper, orientation='portrait', display_sideways=None)

A single page in a document.

A Page is a Container, so other containers can be added as children.

Parameters:
document_part : DocumentPart

the document part this page is part of

number : int

the 1-based index of this page in the document part

paper : Paper

determines the dimensions of this page

orientation : PageOrientation

the orientation of this page

display_sideways : Sideways

display the page rotated

property page

Returns the page itself.

render()

Render the contents of this container to its canvas.

Note that the rendered contents need to be place()d on the parent container’s canvas before they become visible.

place()

Place this container’s canvas onto the parent container’s canvas.

class rinoh.document.PageOrientation

Accepts: portrait, landscape

class rinoh.document.PageType

Accepts: left, right, any

class rinoh.document.PageNumberFormat

How (or if) page numbers are displayed

Accepts: none, number, symbol, lowercase character, uppercase character, lowercase roman, uppercase roman, continue