Document (rinoh.document)¶
-
class rinoh.document.DocumentTree(flowables, options=
None, style=None, source=None)¶ Holds the document’s contents as a tree of flowables
-
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
- element_style(element)¶
Return the
ElementStylefor elementThese are stored in
element_stylesby the id of element. Entries are removed when element is garbage collected, so that its id can’t be mistaken for that of a new element.
-
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
Pageis aContainer, 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()¶
Write this container’s contents onto the page’s canvas
The contents are written directly to page_canvas instead of to the parent container’s canvas, so that they are copied only once.
- 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