Setting TrueTypeFilename not working


Hi! It seems like setting the TrueTypeFilename in Aspose.PDF for .NET 3.5 does not work.
pdf.TextInfo.TruetypeFontFileName = @"c:\\ARIALUNI.TTF";

Do you have any idea why and what are my other alternatives? I don't want to set the font on each element. Thanks!
This message was posted using Aspose.Live 2 Forum


Hi! It seems like setting the TrueTypeFilename in Aspose.PDF for .NET 3.5 does not work.
pdf.TextInfo.TruetypeFontFileName = @“c:\ARIALUNI.TTF”;

Do you have any idea why and what are my other alternatives? I don’t want to set the font on each element. Thanks!

Hi,

Thanks for using our products.

I am afraid you cannot specify the font name for complete PDF document and you need to specify the font name for each text segment. However, you can programmatically specify the font name for all the segments in a Text paragraph. Please take a look over the following code snippet in which Arial font is used for all the segments in a Text paragraph.

[C#]

Pdf pdf = new Pdf();
Aspose.Pdf.Section sec1 = pdf.Sections.Add();

Text text_paragraph = new Text("sample text");
text_paragraph.Segments.Add("#$NL new line");
for (int segment_counter = 0; segment_counter < text_paragraph.Segments.Count; segment_counter++)
{
text_paragraph.Segments[segment_counter].TextInfo.FontName = "Arial";
}
sec1.Paragraphs.Add(text_paragraph);
pdf.Save(@"d:/pdftest/TrueTypeUnicode.pdf");

In case you have any further query, please feel free to contact. We apologize for your inconvenience.

Thank you so much Nayyer! :slight_smile: