Skip to main content

GetOutlineLvl

Returns the outline level of the specified properties.

Inherited from ApiParaPr.GetOutlineLvl.

Syntax​

expression.GetOutlineLvl();

expression - A variable that represents an ApiParagraph class.

Parameters​

This method doesn't have any parameters.

Returns​

Number | undefined

Example​

Check the heading level assigned to a paragraph in a PDF.

// How do I determine the outline level of a paragraph in a PDF?

// Read the current heading level setting for a paragraph in a PDF.

const doc = Api.GetDocument();
const page = doc.GetPage(0);

const rgb = Api.CreateRGBColor(50, 100, 150);
const fill = Api.CreateSolidFill(rgb);
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape('rect', 200 * 36000, 50 * 36000, fill, stroke);
shape.SetPosition(10 * 36000, 10 * 36000);
page.AddObject(shape);

const content = shape.GetContent();
const paragraph = content.GetElement(0);

const levelBefore = paragraph.GetOutlineLvl();
paragraph.SetOutlineLvl(8);
const levelAfter = paragraph.GetOutlineLvl();

let text = 'Outline level (index) for this paragraph is currently set to ' + levelAfter;
text += ',\n';
text += 'but originally was set to ' + levelBefore;
paragraph.AddText(text);