DS Server

Page Object

Object|Introduced in 28.0

Description

A Page object represents a formatted page of a document. Pages are numbered from the beginning to the end of the document beginning with 1. A document has at least one page. Each section of a document can have one or more pages depending on the text that is contained in the section. A section does not have to begin at the top of a page. Therefore more than one section can be on one page. This collection is only available, if the ViewMode has been set to PageView.

Syntax

Page

Examples

The following example demonstrates Page in a practical document-editing workflow. A Page object represents a formatted page of a document. Pages are numbered from the beginning to the end of the document beginning with 1. A document has at least one page. Each section of a document can have one or more pages depending on the text that is contained in the section. A section does not have to begin at the top of a page. Therefore more than one section can be on one page. This collection is only available, if the ViewMode has been set to PageView.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectPage(page) {
    page.getBounds(
        function(rect) {
            if (!rect) {
                console.warn("No rectangle was returned.");
                return;
            }
            
            console.log("get bounds result:", rect);
        },
        onTxError
    );
}

Members

Methods

MethodDescription
getBoundsGets the bounding rectangle of the page, in twips, relative to the top of the document.
getFooterGets the footer of the page.
getHeaderGets the header of the page.
getImageGets an image of the page's contents as in the specified format in screen resolution.
getLengthGets the number of characters of the page, including the page break character at the end of the page.
getNumberGets the page's number.
getNumberInSectionGets the page number relative to the beginning of the section the page belongs to.
getSectionGets the number, one-based, of the section the page belongs to.
getStartGets the number (one-based) of the page's first character.
getTextBoundsGets the bounding rectangle of the page's text, in twips, relative to the top of the document.
selectSelects the text of the page.