Skip to content

Pages

The LAY methods that work on the pages are:

getPagesCount

The getPagesCount method returns the number of pages in the layout of the document.

For example the instruction:

var pagesCount = LAY.getpagesCount();

sets a variable called pagesCount that, considering the Extract example output described in the dedicated page, is set to the value of 1.

The syntax is:

LAY.getPagesCount()

getPage

The getPage method returns the block of the page with the given page number, or undefined if the page number is invalid.

For example, considering the Extract example output introduced in the dedicated page, the instruction:

var page = LAY.getPage(1);

sets a page variable whose value is an object corresponding to the specified page number:

    {
    "id": 1,
    "parent": -1,
    "pageNumber": 1,
    "type": "page",
    "x0": 0,
    "y0": 0,
    "x1": 850,
    "y1": 1100,
    "children": [2,3,4,5,6,7,8,21,64,65,66,67,68,69],
    "beginPos": -1,
    "endPos": -1,
    "tokenBegin": -1,
    "tokenEnd": -1,
    "wordBegin": -1
    "wordEnd": -1
    "label": ""
    }

Watch the Blocks fields table to know about the Pages fields.

The highlighted lines represent the whole page coordinates.

The syntax is:

LAY.getPage(pageNumber)

where pageNumber is the number of the page.