Skip to content


The LAY methods that work on the titles are:


The getTitlesCount method returns the number of titles in the document layout.

For example the instruction:

var titlesCount = LAY.getTitlesCount();

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

The syntax is:



The getTitle method returns the block of the title with the given index, or undefined if the title index is invalid.

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

var titleBlock = LAY.getTitle(1);

sets a titleBlock variable whose value is an object corresponding to the specified index:

    "id": 5,
    "parent": 1,
    "pageNumber": 1,
    "type": "title",
    "x0": 67,
    "y0": 234,
    "x1": 179,
    "y1": 257,
    "children": [],
    "beginPos": 42,
    "endPos": 52,
    "tokenBegin": 13,
    "tokeenEnd": 14,
    "wordBegin": 13,
    "wordEnd": 14,
    "label": "H1",   
    "titleIndex": 4,
    "level": 1


Field name Description Field type Default value
titleIndex The position of the block in the index of the titles Integer -1
level The level of the title Integer -1

Watch the Blocks fields to know about the common fields of this object.


The value of the field "label" is H1 and that means Heading 1 (title of first level) as confirmed by the level field.

The syntax is:


where titleIndex is the index of the title. It must be contained in the range [0, n], where n is the number of titles.