Word -> PDF: TOC Error


#1

Hello,

I am encountering a problem with converting this word document to PDF using the latest version of Aspose.PDF (2.9.5) and the page with the Table of Contents (TOC) give an error. The rest of the page shows up just fine. Attached is the word document I am trying to convert. Also my code to convert is simply this:



Document doc = new Aspose.Words.Document(filename);

MemoryStream stream = new MemoryStream();
doc.Save(stream, SaveFormat.FormatAsposePdf);

//Read the document in Aspose.Pdf.Xml format into Aspose.Pdf.
Pdf pdf = new Pdf();
pdf.IsCoreFontUsed = false;
pdf.TextInfo.IsFontEmbedded = true;

foreach (Aspose.Pdf.Section section in pdf.Sections)
foreach (Aspose.Pdf.Paragraph paragraph in section.Paragraphs)
if (paragraph is Aspose.Pdf.Text)
foreach (Aspose.Pdf.Segment segment in ((Aspose.Pdf.Text)paragraph).Segments)
segment.TextInfo.IsFontEmbedded = true;

pdf.BindXML(stream, null);
iStepNumber++;

pdf.Save(outpath + filename + “.pdf”);



Your help would be greatly appreciated.

Best Regards,

Patrick

#2

Thanks for considering Aspose.

Plz reattach your word document, it seems not to be posted correctly.


#3

Thanks for considering Aspose.

We will check it out and reply to you ASAP.


#4

Dear Patrick,

Thank you for considering Aspose.

This problem is caused by font. The "Helvetica" is used in your document but usually this TrueType font is not installed in the system. Aspose.Pdf needs the font installed in the system. I tried changing the font to Arial and it works.