TruetypeFontFileName = null after setting it in v.4.1.2.0!

Hi,

I once again tried to upgrade Aspose.Pdf from 3.6.2, but it keeps on breaking in my test sets… this is getting very frustrating.

Why does TextInfo.TruetypeFontFileName remains NULL after setting it in v.4.1.2.0?? As a results, the following code crashes on Windows 7 x64 with the exception “The Font ‘Times New Roman or C:\Windows\fonts\times.ttf’ is not found. This font is not supported.” The exact same code works flawlessly with v3.6.2.0 !

Commenting out the “no style text” does not change anything, it still crashes with the same exception.

Please advise, thank you,

Dominic.

///


/// Embedding True Type Font
///

public static void TestAsposePdf09()
{
// Create PDF document
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.IsFontNotFoundExceptionThrown = true;

Aspose.Pdf.Section pdfSection;
pdfSection = pdf.Sections.Add();

Aspose.Pdf.Text pdfText;
Aspose.Pdf.Segment pdfSegment;

string str;

// Not embedded
pdfText = new Aspose.Pdf.Text(pdfSection);
pdfSection.Paragraphs.Add(pdfText);

pdfSegment = new Aspose.Pdf.Segment(pdfText);
pdfText.Segments.Add(pdfSegment);

pdfSegment.Content = “TEXT WITHOUT EMBEDDED FONT”;

// Extra content
pdfText = new Aspose.Pdf.Text(pdfSection);
pdfSection.Paragraphs.Add(pdfText);

pdfSegment = new Aspose.Pdf.Segment(pdfText);
pdfText.Segments.Add(pdfSegment);

str = “”;
str += “\n” + “Line 1” + “\n” + “Line 2”;
pdfSegment.Content = str;

// Embedded TTF
Aspose.Pdf.TextInfo textInfoTtf = new Aspose.Pdf.TextInfo();
textInfoTtf.FontSize = 18;
textInfoTtf.IsUnicode = true;
textInfoTtf.TruetypeFontFileName = @“C:\dev\quicktest\App_data\MyriadProBold.ttf”;
textInfoTtf.IsFontEmbedded = true;

pdfText = new Aspose.Pdf.Text(pdfSection);
pdfText.TextInfo = textInfoTtf;
pdfSection.Paragraphs.Add(pdfText);

pdfSegment = new Aspose.Pdf.Segment(pdfText);
pdfText.Segments.Add(pdfSegment);

pdfSegment.Content = “TEXT WITH EMBEDDED FONT”;

// Extra content
pdfText = new Aspose.Pdf.Text(pdfSection);
pdfText.TextInfo = textInfoTtf;
pdfSection.Paragraphs.Add(pdfText);

pdfSegment = new Aspose.Pdf.Segment(pdfText);
pdfText.Segments.Add(pdfSegment);

str = “”;
str += “\n” + “Line 1” + “\n” + “Line 2”;
pdfSegment.Content = str;

string asmVersion = typeof(Aspose.Pdf.Pdf).Assembly.GetName().Version.ToString();
pdf.Save(“c:\temp\pdfTest09-v” + asmVersion + “.pdf”);
}

Hello Dominic,

Sorry for replying you late.

I have tested the issue and I’m able to reproduce the same problem. We will investigate this issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

The issues you have found earlier (filed as 14504) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.