跳到主要内容

GetRotation

返回当前绘图对象的旋转角度。

继承自 ApiDrawing.GetRotation

示例

如何从 PDF 文档中的绘图对象获取旋转角度。

// Get drawing rotate in a PDF document.

// Get the rotation for a drawing object in a PDF document.

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

const fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape("rect", 65 * 36000, 10 * 36000, fill, stroke);
shape.SetPosition(100000, 2500000);
shape.SetRotation(90);

let rotAngle = shape.GetRotation();
let docContent = shape.GetContent();
let paragraph = docContent.GetElement(0);
paragraph.AddText("Drawing rotation angle is: " + rotAngle + " degrees");
page.AddObject(shape);