跳到主要内容

Push

Pushes a rich paragraph to a rich content.

Syntax

expression.Push(richPara);

expression - A variable that represents a ApiRichContent class.

Parameters

NameRequired/OptionalData typeDefaultDescription
richParaRequiredApiRichParagraphThe rich paragraph which will be pushed to the rich content.

Returns

boolean

Example

This example pushes a new element to rich content.

let doc = Api.GetDocument();
let freeTextAnnot = Api.CreateFreeTextAnnot([160, 50, 360, 135]);
let page = doc.GetPage(0);
page.AddObject(freeTextAnnot);
freeTextAnnot.SetIntent("freeTextCallout");
freeTextAnnot.SetCallout([{x: 161, y: 51}, {x: 249, y: 125}, {x: 261, y: 125}]);
freeTextAnnot.SetRectDiff([100, 64, 0.5, 0.5]);

let richContent = freeTextAnnot.GetContent();
let para = Api.CreateRichParagraph();
para.AddText("Example text");
richContent.Push(para);

console.log(`We pushed new paragraph to content`);