Page Reference

class pdfnaut.objects.page.Page[source]

Bases: PdfDictionary

A page in a PDF document (see ISO 32000-2:2020 § 7.7.3.3 “Page objects”).

Parameters:
  • size (tuple[float, float]) – The width and height of the physical medium in which the page should be printed or displayed. Values shall be provided in multiples of 1/72 of an inch (points).

  • pdf (PdfParser, optional) –

    The PDF document that this page belongs to.

    In typical usage, this value need not be specified. pdfnaut will take care of populating it.

  • indirect_ref (PdfReference, optional) –

    The indirect reference that this page object is referred to by.

    As with pdf, this value need not be specified in typical usage.

__init__(size: tuple[float, float], *, pdf: PdfParser | None = None, indirect_ref: PdfReference | None = None) None[source]
property annotations: AnnotationList | None

All annotations associated with this page. If a page does not specify a list of annotations, this field is none.

artbox: list[float] | None

A rectangle defining the extent of the page’s meaningful content as intended by the page’s creator.

If none, the artbox is the same as the cropbox.

bleedbox: list[float] | None

A rectangle defining the region to which the contents of the page shall be clipped when output in a production environment.

If none, the bleedbox is the same as the cropbox.

property content_stream: ContentStreamTokenizer | None

An iterator over the instructions producing the contents of this page.

cropbox: list[float] | None

A rectangle defining the visible region of the page.

If none, the cropbox is the same as the mediabox.

mediabox: list[float]

A rectangle defining the boundaries of the physical medium in which the page should be printed or displayed.

metadata: PdfStream | None

A metadata stream, generally written in XMP, containing information about this page.

new_annotations() None[source]

Creates a new annotation list.

resources: PdfDictionary | None

Resources required by the page contents.

If the page requires no resources, this should return an empty resource dictionary. If the page inherits its resources from an ancestor, this should return None.

rotation: int

The number of degrees by which the page shall be visually rotated clockwise. The value is a multiple of 90 (by default, 0).

tab_order: Literal['R', 'C', 'S', 'A', 'W'] | None

(optional; PDF 1.5) The tab order to be used for annotations on the page. If present, it shall be one of the following values:

  • R: Row order

  • C: Column order

  • S: Logical structure order

  • A: Annotations array order (PDF 2.0)

  • W: Widget order (PDF 2.0)

trimbox: list[float] | None

A rectangle defining the intended dimensions of the finished page after trimming.

If none, the trimbox is the same as the cropbox.

user_unit: float

The size of a user space unit, in multiples of 1/72 of an inch (by default, 1).