跳到主要内容

GetPosition

获取批注位置。

继承自 ApiBaseAnnotation.GetPosition

示例

获取 PDF 中注释的位置坐标。

// What are the horizontal and vertical coordinates of an annotation in a PDF?

// Retrieve the X and Y position values from an annotation object in a PDF.

let doc = Api.GetDocument();
let squareAnnot = Api.CreateSquareAnnot([10, 10, 160, 32]);
let page = doc.GetPage(0);
page.AddObject(squareAnnot);
let pos = squareAnnot.GetPosition();
console.log(`Annot position x: ${pos.x}, y: ${pos.y}`);