跳到主要内容

GetEndPoint

获取线条终点。

语法

expression.GetEndPoint();

expression - 表示 ApiLineAnnotation 类的变量。

参数

此方法没有任何参数。

返回值

Point

示例

查找 PDF 中线条注释的结束位置。

// How do I find the ending position of a line in a PDF?

// Retrieve the coordinates of the line's endpoint in a PDF.

let doc = Api.GetDocument();
let lineAnnot = Api.CreateLineAnnot([10, 10, 160, 32], {x: 12, y: 12}, {x: 155, y: 30});
lineAnnot.SetEndStyle("openArrow");
let page = doc.GetPage(0);
page.AddObject(lineAnnot);
let endPoint = lineAnnot.GetEndPoint();
console.log(`End point is: x: ${endPoint.x}, y: ${endPoint.y}`);