Catalog Reference

class pdfnaut.objects.catalog.DeveloperExtension[source]

Bases: PdfDictionary

An entry in an extension dictionary.

See ISO 32000-2:2020 § 7.12.3 “Developer extensions dictionary” for details.

__init__(base_version, level, url=None, revision=None)
base_version: Annotated[str, 'name']

The PDF version to which this extension applies. This value shall be consistent with the syntax used for the Version entry of the document catalog dictionary.

level: int

An developer-defined integer denoting the extension being used.

If the developer introduces more than one extension to a given base version, the extension level assigned by the developer should increase over time.

revision: str | None

(PDF 2.0) Additional revision information on the extension level being used.

url: str | None

(PDF 2.0) A URL referring to the documentation for this extension.

class pdfnaut.objects.catalog.ExtensionMap[source]

Bases: PdfDictionary

A map defining developer extensions in a document.

See ISO 32000-2:2020 § 7.12 “Extensions dictionary” for details.

query(key: str) DeveloperExtension | list[DeveloperExtension][source]

Returns a developer-defined extension (or a sequence of them) for a base prefix key.

class pdfnaut.objects.catalog.MarkInfo[source]

Bases: PdfDictionary

Information relevant to specialized uses of structured PDF documents.

See ISO 32000-2:2020 § 14.7 “Logical structure” for details.

__init__(marked=False, suspects=False, user_properties=False)
marked: bool

Whether the document claims to conform to tagged PDF conventions.

suspects: bool

(PDF 1.6; deprecated in PDF 2.0) Whether the document includes tag suspects which are applied for marked content elements whose page content order could not be determined.

In such case, the document may not fully conform to tagged PDF conventions.

user_properties: bool

(PDF 1.6) Whether structure elements including user properties are present in the document.

See ISO 32000-2:2020 § 14.7.6.4 “User properties” for details.

class pdfnaut.objects.catalog.UserAccessPermissions[source]

Bases: IntFlag

User access permissions as specified in the P entry of the document’s standard encryption dictionary.

See ISO 32000-2:2020 “Table 22 - Standard security handler user access permissions” for details.

ACCESSIBILITY = 512

(deprecated in PDF 2.0) Extract content for the purposes of accessibility.

This bit should always be set for compatibility with processors supporting earlier specifications.

ASSEMBLE_DOCUMENT = 1024

For security revision 3 or greater, assemble the document (i.e. insert, rotate, and delete pages, create outlines, etc.), even if MODIFY is clear.

COPY_CONTENT = 16

Copy or extract text and graphics. Assistive technology should assume this bit as set for its purposes, as per ACCESSIBILITY.

FAITHFUL_PRINT = 2048

For security revision 3 or greater, print the document in such a way that a faithful digital representation of the PDF can be generated.

If this bit is not set (and PRINT is set), printing shall be limited to a low-level representation, possibly of lower quality.

FILL_FORM_FIELDS = 256

For security revision 3 or greater, fill existing interactive form fields, even if MANAGE_ANNOTATIONS is clear.

MANAGE_ANNOTATIONS = 32

Add or modify text annotations, fill interactive form fields and, depending on whether MODIFY is set, create and modify form fields.

MODIFY = 8

Modify the contents of the document. May be influenced by MANAGE_ANNOTATIONS, FILL_FORM_FIELDS, and ASSEMBLE_DOCUMENT.

PRINT = 4

For security revision 2 or greater, Print the document. If the document uses revision 3 or greater, print quality may be influenced by FAITHFUL_PRINT.

__new__(value)
class pdfnaut.objects.catalog.ViewerPreferences[source]

Bases: PdfDictionary

The viewer preferences dictionary specifying the way a PDF viewer shall display a document on the screen.

See § 12.2, “Viewer preferences” for details.

__init__(hide_toolbar=False, hide_menubar=False, hide_window_ui=False, fit_window=False, center_window=False, display_doc_title=False, non_full_screen_page_mode='UseNone', direction='L2R', view_area='CropBox', view_clip='CropBox', print_area='CropBox', print_clip='CropBox', print_scaling='AppDefault', duplex=None, pick_tray_by_pdf_size=None, print_page_range=None, num_copies=None)
center_window: bool

Whether to center the document’s window position on the screen.

direction: Literal['L2R', 'R2L']

The predominant logical content order for text. Either ‘L2R’ (left to right, default) or ‘R2L’ (right to left). This is effectively a display hint and has no direct effect on the contents of the document.

display_doc_title: bool

(PDF 1.4) Whether the document’s window title should display the title described in the document’s metadata. If False, the title bar should instead display the name of the PDF file containing the document.

duplex: Literal['Simplex', 'DuplexFlipShortEdge', 'DuplexFlipLongEdge'] | None

The paper handling option to use when printing the document. Should be either of:

  • Simplex: Print single-sided

  • DuplexFlipShortEdge: Duplex, flip on the short edge of the sheet

  • DuplexFlipLongEdge: Duplex, flip on the long edge of the sheet

If this value is none, the document producer may choose their own default setting.

property enforce: list[Literal['PrintScaling']] | None

(PDF 2.0) An array of names of viewer preferences that shall be enforced by PDF processors and that shall not be overridden by subsequent selections in the application user interface.

fit_window: bool

Whether to resize the document’s window to fit the size of the page.

hide_menubar: bool

Whether to hide the interactive PDF processor’s menubar when the document is active.

hide_toolbar: bool

Whether to hide the interactive PDF processor’s toolbars when the document is active.

hide_window_ui: bool

Whether to hide UI elements in the document’s window (such as scroll bars or navigation controls), leaving only the document’s contents displayed.

non_full_screen_page_mode: Literal['UseNone', 'UseOutlines', 'UseThumbs', 'UseOC']

The document’s page mode displayed when exiting full-screen mode. This property is only relevant if the PageMode entry in the catalog is set to ‘FullScreen’ and should be ignored otherwise. Accepted values are ‘UseNone’, ‘UseOutlines’, ‘UseThumbs’, and ‘UseOC’.

num_copies: int | None

The number of copies that shall be printed when the print dialog is opened for this file.

If this value is none, the document producer may choose their own default setting, though this setting is usually 1.

pick_tray_by_pdf_size: bool | None

Whether the PDF page size shall be used to select the input paper tray. This setting influences only the preset values used to populate the print dialog. This setting has no effect on systems that do not provide the ability to pick the input tray by size.

If this value is none, the document producer may choose their own default setting.

print_area: Literal['MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox']

(deprecated in PDF 2.0) The name of the page boundary representing the area of a page that shall be rendered when printing the document. Similar to ViewArea, the value should be the key of the relevant page boundary in a page object.

print_clip: Literal['MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox']

(deprecated in PDF 2.0) The name of the page boundary representing to which the contents of a page shall be clipped when printing the document. Similar to ViewArea, the value should be the key of the relevant page boundary in a page object.

print_page_range: list[int] | None

The page numbers used to initialize the print dialog box. The array should contain an even number of values interpreted as pairs, with each pair specifying the first and last pages in a sub-range of pages to be printed (the first page being denoted by the number 1).

If this value is none, the document producer may choose their own default setting.

print_scaling: Literal['None', 'AppDefault']

The page scaling option to select when a print dialog is displayed for this document.

Accepted values are ‘None’ meaning no page scaling or ‘AppDefault’ (default) indicating that the interactive PDF processor should select its default print scaling value.

view_area: Literal['MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox']

(deprecated in PDF 2.0) The name of the page boundary representing the area of a page that shall be displayed when viewing the document on the screen. The value should be the key of the relevant page boundary in a page object. If no such boundary is defined, the default value (‘CropBox’) is used.

Accepted values are ‘CropBox’, ‘MediaBox’, ‘BleedBox’, ‘TrimBox’, and ‘ArtBox’.

view_clip: Literal['MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox']

(deprecated in PDF 2.0) The name of the page boundary representing to which the contents of a page shall be clipped when viewing the document. Similar to ViewArea, the value should be the key of the relevant page boundary in a page object.