Titles
The LAY
methods that work on the titles are:
LAY.getTitlesCount()
Returns the number of titles in the document layout.
For example the instruction:
var titlesCount = LAY.getTitlesCount();
returns the integer value 1 in the titlesCount
variable.
LAY.getTitle(titleIndex)
Returns the block of the title with the given index, or undefined
if the title index is invalid.
Info
The index of the title is not the id of the block. It must be contained in the range [0, n]
, where n
is the number of titles.
For example the instruction:
var titleBlock = LAY.getTitle(1);
returns the following object in the titleBlock
variable:
{
"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
}
where:
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.
Info
The value of the field "label"
is H1 and that means Heading 1 (title of first level) as confirmed by the "level"
field.