The primary interface to the application state.
This holds much of the global state for interacting with the API,
and must be created (and
create_document() must be called) before
working with the API.
Remove all fonts registered with
This is primarily useful for testing purposes.
Open a window showing a preview of the document.
Render the document to a pdf file.
(iter[int]): The page numbers to render
(str): An output file path.
If the file at
path already exists, it will be overwritten.
(rect, image_path, dpm, quality, bg_color, autocrop)
Render a section of self.scene to an image.
(Rect): The part of the document to render,
in document coordinates.
(str): The path to the output image.
This must be a valid path relative to the current
(int): The pixels per meter of the rendered image.
(int): The quality of the output image for compressed
image formats. Must be either
-1 (default compression) or
0 (most compressed) and
100 (least compressed).
(Color): The background color for the image.
(bool): Whether or not to crop the output image to tightly
fit the contents of the frame. If true, the image will be
cropped such that all 4 edges have at least one pixel not of
It is assumed that all input arguments are valid.
Destroy the window and all global interface-level data.
Register a font file with the graphics engine.
(str): A path to a font file. The path should
be relative to the main
brown package. Currently only
TrueType and OpenType fonts are supported.