Skip to main content

Objects and properties

Table of contents


shape object

A shape object represents a single element in the PDF document.

There are three fundamental types of shapes:

  • Text: Represents textual content within a document. In most PDF documents, paragraphs are composed of multiple text shapes, each representing anything from individual characters to partial word fragments, or entire lines of text.
  • Image: Represents raster or bitmap graphics embedded in the document
  • Path: Represents vector graphics, such as lines, curves, and geometric shapes

A shape object has the following properties. Some properties are only applicable to specific shape types, as described in the following sections.

type (String)

Represents one of the three base types that a shape can have: text, image and path.

Examples:

shape.type = "text"
shape.type = "image"
shape.type = "path"

page (Integer)

The page property returns a page object as described in the following section page object.

font (Font)

The font property returns a font object of a text shape as described in the following section font object.

text (String)

Represents the text value of a text shape.

Note that a word or a line in a PDF document often consists of many individual shapes. In such cases, the text property does not evaluate the text of the entire word or line, but always refers to a single shape object.

Example:

shape.text = "hello"

left, right, top, bottom (Double)

These four properties return the coordinates of a shape relative to the entire document, in points.

The coordinate origin in a PDF document is located at the bottom-left corner. Document coordinates extend from the bottom-left corner of the last page to the top-right corner of the first page.

Examples:

shape.left = 20.0        // Note: equivalent to shape.docBBox.left = 20.0
shape.right = 200.0      // Note: equivalent to shape.docBBox.right = 200.0
shape.top = 500.0        // Note: equivalent to shape.docBBox.top = 500.0
shape.bottom = 30.0      // Note: equivalent to shape.docBBox.bottom = 30.0

width, height (Double)

These two properties return the width and the height of a shape in points.

Examples:

shape.width = 200.0
shape.height = 34.0

lineWidth (Double)

Returns the line width of a path shape in points.

Example:

shape.lineWidth = 0.5

fill, stroke (Color)

These two properties return the fill and the stroke color of a text or path shape.

Examples:

shape.fill = #0000FF
shape.stroke = #000000

pageBBox (Rectangle)

Returns the bounding box coordinates of a shape object as a Rectangle, relative to its page

Page coordinates are measured in points and extend from the bottom-left corner to the top-right corner of the page.

A single shape object always belongs to one page and therefore has exactly one pageBBox.

Example: Selects shapes on every page of the document that match the specified coordinates exactly:

shape.pageBBox = Rectangle(60.0, 590.0, 400.0, 700.0)

left, right, top, bottom (Double)

These four properties return the coordinates of a shape relative to its page, in points.

Example: Selects shapes on every page of the document whose bottom coordinate is greater than 500 points, measured from the bottom of its page:

shape.pageBBox.bottom > 500

width, height (Double)

These two properties return the width and height of the pageBBox object, in points.

Examples:

shape.pageBBox.width < 600
shape.pageBBox.height > 800

docBBox (Rectangle)

Returns the bounding box coordinates of a shape as a Rectangle, relative to the entire document.

Document coordinates are measured in points and use a coordinate system where the origin is located at the bottom-left corner of the last page, extending to the top-right corner of the first page.

Example 1: This selects shapes that match the specified coordinates exactly, measured from the bottom of the last page:

shape.docBBox = Rectangle(60.0, 590.0, 400.0, 700.0)

Example 2: This selects all shapes whose bottom coordinate is greater than 500 points, measured from the bottom of the last page:

shape.docBBox.bottom > 500    // equivalent to shape.bottom > 500

Example 3:

item.docBBox inside Rectangle(40.0, 20.0, 250.0, 400.0) 

// is equivalent to:

item.left >= 40.0 and
item.bottom >= 20.0 and
item.right <= 250.0 and
item.top <= 400.0

shape tree object

A shape tree object is a hierarchical data structure that represents a collection of content shapes within a document. These shapes are organized into containers, which can themselves contain other containers, forming a multi-level, nested structure.

Each shape tree consists of:

  • Shape objects: The individual content elements from the document
  • Containers: Logical groupings of shapes that can encapsulate other containers or shapes, enabling hierarchical organization

This structure allows complex documents to be represented as trees, where elements can be accessed, grouped, and processed efficiently.

Shape trees serve as the primary objects processed by most nodes in axesFlip.

The way a shape tree is referenced depends on the input port of the node. In most cases, the relevant input port is named items. In this context, each shape tree within the input sequence is accessed using the variable item, which represents one shape tree at a time during processing.

To navigate within a shape tree and select specific shapes or containers, a Path language is used. This enables precise targeting of elements within the hierarchical structure.

pages (Sequence of page objects)

Returns a sequence of page objects, where each entry represents a page containing shapes from the shape tree object. Use the sequence indexer [] (zero-based) to access a specific page within the sequence.

All properties of the page object are described in the following section page object.

Example:

item.pages[0]                      // returns the index of the first page containing shapes from the shape tree
item.pages[item.pages.count - 1]   // returns the index of the last page containing shapes from the shape tree

text (String)

Represents the complete text content of a shape tree, rather than the text of an individual shape.
If a shape tree contains multiple text shapes, the text value is calculated by combining the text from all those shapes into a single aggregated string.

Example:

item.text match "This is an example paragraph derived from multiple text shapes."

left, right, top, bottom (Double)

These four properties return the coordinates of a shape tree relative to the entire document, in points.

The coordinate origin in a PDF document is located at the bottom-left corner. Document coordinates extend from the bottom-left corner of the last page to the top-right corner of the first page.

Examples:

item.left = 40.0        // Note: equivalent to item.docBBox.left = 40.0
item.right = 250.0      // Note: equivalent to item.docBBox.right = 250.0
item.top = 400.0        // Note: equivalent to item.docBBox.top = 400.0
item.bottom = 20.0      // Note: equivalent to item.docBBox.bottom = 20.0

width, height (Double)

These two properties return the width and the height of a shape tree in points.

Examples:

item.width = 400.0
item.height = 70.0

pageBBoxes (Sequence of pageBBox rectangles)

Returns the bounding box coordinates of a shape tree object as a sequence of Rectangles, relative to their pages

For shape trees (groups of shapes), multiple bounding boxes may exist if the shapes span across different pages. In this case, each page has its own bounding box. Use the sequence indexer [] (zero-based) to access a specific pageBBox within the sequence.

All properties of the pageBBox rectangles are described in the following section.

Example:

item.pageBBoxes[0]                           // returns the first bounding box of a shape tree
item.pageBBoxes[item.pageBBoxes.count - 1]   // returns the last bounding box of a shape tree

pageBBox (Rectangle)

Returns the bounding box coordinates of a shape tree object as a Rectangle, relative to its page

Page coordinates are measured in points and extend from the bottom-left corner to the top-right corner of the page.

A single shape object always belongs to one page and therefore has exactly one pageBBox.

For shape tree objects (groups of shapes), multiple bounding boxes may exist if the shapes span across different pages. In this case, each page has its own bounding box. Use the sequence indexer [] (zero-based) to access a specific pageBBox within the sequence.

Example: Checks whether the first bounding box of a shape tree lies completely within the specified rectangle:

item.pageBBoxes[0] inside Rectangle(60.0, 590.0, 400.0, 700.0) ? true : false

left, right, top, bottom (Double)

These four properties return the coordinates of a shape tree relative to its page, in points.

Example: Selects shapes trees on every page of the document whose first bounding box has a bottom coordinate greater than 500 points, measured from the bottom of its page:

item.pageBBoxes[0].bottom > 500

width, height (Double)

These two properties return the width and height of a pageBBox rectangle, in points.

Examples:

item.pageBBoxes[2].width > 600
item.pageBBoxes[2].height < 800

docBBox (Rectangle)

Returns the bounding box coordinates of a shape tree object as a Rectangle, relative to the entire document.

Document coordinates are measured in points and use a coordinate system where the origin is located at the bottom-left corner of the last page, extending to the top-right corner of the first page.

Examples:

item.docBBox = Rectangle(40.0, 20.0, 250.0, 400.0)

item.docBBox.left = 40.0        // equivalent to item.left = 40.0
item.docBBox.bottom = 20.0      // equivalent to item.bottom = 20.0
item.docBBox.right = 250.0      // equivalent to item.right = 250.0
item.docBBox.top = 400.0        // equivalent to item.top = 400.0


font object

name (String)

Returns the name of a font.

Example:

shape.font.name = "Arial"

size (Double)

Returns the size of a font.

Example:

shape.font.size = 16.0

document object

Represents the entire document. 

pages (Sequence of page objects)

Use the sequence indexer [] (zero-based) to select an individual page from the sequence. All properties of the page object are described in the following section page object.

Example:

document.pages[0]                           // returns the first page of the document
document.pages[document.pages.count - 1]    // returns the last page of the document

metadata (Metadata)

The metadata property returns a metadata object as described in the following section metadata object.

viewer (Viewer)

The viewer property returns a viewer object as described in the following section viewer object.


page object

Represents a single page in a document.

A shape object always belongs to exactly one page and therefore references a single page object.

A shape tree object (a group of shapes) may span multiple pages. In such cases, it provides a sequence of page objects, where each entry represents a page containing shapes from the shape tree. 

The document object also provides a sequence of page objects representing all pages in the document.

Use the sequence indexer [] (zero-based) to access a specific page within the sequence.

index (Integer)

Returns the zero-based index of an individual page within the document.

Examples:

shape.page.index = 0       // finds all shapes on the first page of the document

item.pages[0].index        // returns the index of the first page containing shapes from the shape tree

document.pages[0].index    // returns 0

width, height (Double)

These two properties return the width and height of the page, respectively, as double values.

Examples:

shape.page.width < 600
shape.page.height > 800

item.pages[0].width > 600
item.pages[3].height < 800

document.pages[0].width > 600
document.pages[10].height < 800

rotation (Integer)

Returns the rotation of a page in degrees as a multiple of 90 (0, 90, 180, 270).

Examples:

shape.page.rotation = 180

item.pages[0].rotation = 270

document.pages[0].rotation = 90

metadata object

Represents the metadata of a document.

title (String)

Returns the document title as defined in the metadata of a document.

Example:

document.metadata.title = "Contract"

languages (Sequence of strings)

Returns the list of languages specified in the metadata of a document.

Example:

document.metadata.languages = ["en","de","fr"]

authors (Sequence of strings)

Returns the list of authors defined in the metadata of a document.

Example:

document.metadata.authors = ["John Doe","Jane Doe"]

subject (String)

Returns the subject of a document as specified in the metadata.

Example:

document.metadata.subject = "Legal Agreement"

keywords (Sequence of strings)

Returns the keywords associated with a document.

Example:

document.metadata.keywords = ["contract","legal","agreement"]

creator (String)

Returns the name of the application or tool that originally created a document.

Example:

document.metadata.creator = "Microsoft Word"

producer (String)

Returns the name of the application or tool that produced the final version of a document (e.g., after processing or conversion).

Example:

document.metadata.producer = "axesFlip"

modificationDate (String)

Returns the date and time when a document was last modified, as specified in the metadata.

Example:

document.metadata.modificationDate = "2026-05-20T14:30:00Z"

creationDate (String)

Returns the date and time when a document was originally created, as specified in the metadata.

Example:

document.metadata.creationDate = "2026-05-18T09:15:00Z"

viewer object

Represents the viewer preferences stored in the current document.

navigation (Integer)

Returns an integer indicating which navigation panel is displayed when the document is opened.

Possible values:

  • Page only: 0
  • Bookmarks panel and page: 1 
  • Pages Panel and Page: 2
  • Layers Panel and Page: 3
  • Attachments Panel and Page: 4

Example:

document.viewer.navigation
// returns an integer indicating which navigation panel is displayed

pageLayout (Integer)

Returns an integer indicating how pages are displayed in the PDF viewer. 

Possible values:

  • Single Page: 0 
  • Single Page Continuous: 1
  • Two-Up (Facing): 2
  • Two-Up Continuous (Facing): 3
  • Two-Up (Cover Page): 4
  • Two-Up Continuous (Cover Page): 5

Example:

document.viewer.pageLayout
// returns an integer indicating how pages are displayed

windowTitle (Integer)

Returns an integer indicating what is shown in the PDF viewer’s title bar.

Possible values:

  • Document Title: 0
  • File Name: 1

Example:

document.viewer.windowTitle
// returns an integer indicating what is shown in the title bar

fullscreen (Boolean)

Returns whether the document is configured to open in fullscreen mode (hiding menu bar, toolbar, and window controls).

Example:

document.viewer.fullscreen
// returns true if the document is configured to open in fullscreen mode

centerWindow (Boolean)

Returns whether the document window is centered on the screen when opened.

Example:

document.viewer.centerWindow
// returns true if the document window is centered on the screen

hideMenu (Boolean)

Returns whether the PDF viewer’s menu bar is hidden when the document is opened.

Example:

document.viewer.hideMenu
// returns true if the menu bar is hidden

hideToolbar (Boolean)

Returns whether the PDF viewer’s toolbar is hidden when the document is opened.

Example:

document.viewer.hideToolbar
// returns true if the toolbar is hidden

hideControls (Boolean)

Returns whether standard window controls (such as minimize, maximize, and close buttons) are hidden.

Example:

document.viewer.hideControls
// returns true if standard window controls are hidden

fitToWindow (Boolean)

Returns whether the document is configured to scale to fit the viewer window when opened.

Example:

document.viewer.fitToWindow
// returns true if the document is scaled to fit the viewer window