GetDashType
获取笔触的虚线类型。
语法
expression.GetDashType();
expression - 表示 ApiStroke 类的变量。
参数
此方法没有任何参数。
返回值
DashType | null
示例
识别 PDF 中边框的线条图案样式
// What dash pattern is applied to a border line in a PDF?
// Extract and show the line style for a border in a PDF
const doc = Api.GetDocument();
const page = doc.GetPage(0);
let fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 200, 100));
let stroke = Api.CreateStroke(36000, Api.CreateSolidFill(Api.CreateRGBColor(0, 0, 255)));
let shape = Api.CreateShape("rect", 100 * 36000, 50 * 36000, fill, stroke);
shape.SetPosition(2000000, 1000000);
page.AddObject(shape);
let content = shape.GetContent();
let paragraph = content.GetElement(0);
let retrievedStroke = shape.GetLine();
let dashType = retrievedStroke.GetDashType();
paragraph.AddText("Dash type: " + (dashType ? dashType : "not set"));