Skip to main content

SetReadingOrder

Specifies the reading order for the current paragraph. Possible values are:

  • null - use the standart direction parameter;
  • "ltr" - left-to-right text direction;
  • "rtl" - right-to-left text direction.

Syntax

expression.SetReadingOrder(readingOrder);

expression - A variable that represents a ApiRichParagraph class.

Parameters

NameRequired/OptionalData typeDefaultDescription
readingOrderOptionalReadingOrderThe reading order.

Returns

ApiRichParagraph

Example

Specify text reading direction for a paragraph in a PDF.

// How do I set the reading direction for a paragraph in a PDF?

// Configure how text flows through a paragraph in a PDF.

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 = richContent.GetElement(0);
let run = para.GetElement(0);
run.AddText("Some paragraph text");
para.SetReadingOrder("rtl");

console.log("We sets rtl to rich paragraph");