Canvas Classes

Canvas

plutoprint.Canvas

Abstract base class for drawing. Supports affine transformations (scale, translate, rotate) and clipping.

PDFCanvas

plutoprint.PDFCanvas

A canvas that outputs to a PDF file.

__init__(path: str, size: PageSize)
create_for_stream(stream: BinaryIO, size: PageSize)
  • show_page(): Finalizes the current page and starts a new one.

ImageCanvas

plutoprint.ImageCanvas

A canvas that renders to a memory buffer/image.

__init__(width: int, height: int, format: ImageFormat)
  • write_to_png(path: str)
  • get_data(): Returns a memoryview of the raw pixel data.