PDF

class PDF

Classes

AttributeList

Metadata

Optional metadata to be passed into the PDF factory function.

StructureElementNode

A node in a PDF structure tree, giving a semantic representation of the content.

Methods

MakeDocument

Overloaded function.

SetNodeId

Associate a node ID with subsequent drawing commands in an Canvas.

__init__

Methods

static PDF.MakeDocument(*args, **kwargs)

Overloaded function.

  1. MakeDocument(stream: skia.WStream, metadata: skia.PDF.Metadata) -> skia.Document

    Create a PDF-backed document, writing the results into a WStream.

    PDF pages are sized in point units. 1 pt == 1/72 inch == 127/360 mm.

    stream:

    A PDF document will be written to this stream. The document may write to the stream at anytime during its lifetime, until either close() is called or the document is deleted.

    metadata:

    a PDFmetadata object. Any fields may be left empty.

    return:

    NULL if there is an error, otherwise a newly created PDF-backed Document.

  2. MakeDocument(stream: skia.WStream) -> skia.Document

  3. MakeDocument(stream: skia.WStream, **kwargs) -> skia.Document

static PDF.SetNodeId(canvas: SkCanvas, nodeId: int) None

Associate a node ID with subsequent drawing commands in an Canvas.

The same node ID can appear in a StructureElementNode in order to associate a document’s structure element tree with its content.

A node ID of zero indicates no node ID.

Parameters:
  • canvas – The canvas used to draw to the PDF.

  • nodeId – The node ID for subsequent drawing commands.

PDF.__init__(*args, **kwargs)