1
我成功地在C#中使用Adobe Illustrator庫閱讀Adobe Illustrator文件,但無法獲取TextFrame的FontSize。誰可以幫忙?以下是我用過的代碼:如何使用C#從Adobe Illustrator(.ai)TextFrame獲取FontSize?
Illustrator.Application aiApp = new Illustrator.Application();
Illustrator.Document doc = aiApp.Open(@"K:\test\test.ai",Illustrator.AiDocumentColorSpace.aiDocumentRGBColor, null);
List<Label> _labela = new List<Label>();
int cntr = 0;
foreach (TextFrame tf in doc.TextFrames)
{
_labela.Add(new Label());
// caktojme vetite per secilen label
_labela[cntr].Name = "lblTextFrame" + cntr;
_labela[cntr].AutoSize = true;
_labela[cntr].Text = tf.Contents;
_labela[cntr].ForeColor = Color.FromArgb((int)tf.Layer.Color.Red, (int)tf.Layer.Color.Green, (int)tf.Layer.Color.Blue);
_labela[cntr].Top = Math.Abs((int)tf.Top);
_labela[cntr].Left = Math.Abs((int)tf.Left);
cntr++;
}
foreach (Label lbl in _labela)
{
//lbl.BackColor = Color.Black;
this.Controls.Add(lbl);
this.SuspendLayout();
this.Refresh();
}
}
我沒有看到TextFrame.FontSize的任何屬性? :(。任何建議!?