I'm successfully reading an Adobe Illustrator file using Adobe Illustrator Library in C# but I can't get the FontSize for a TextFrame. Can Anyone help? Below is the code I've used:
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();
}
}
I don't see any properties for TextFrame.FontSize ??? :( . Any suggestions!?
You read the font name & size like this
for (int i = 1; i <= doc.TextFrames.Count; i++)
{
Illustrator.TextFrame tF = doc.TextFrames[i];
Illustrator.TextFont objFont = tF.TextRange.CharacterAttributes.TextFont;
double size = tF.TextRange.CharacterAttributes.Size;
Console.WriteLine("Size: {0}, FontName: {1})", size, objFont.Name);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.