Issue with TOC Formatting When Converting Word Document to PDF

Dear Aspose Support Team,

I am experiencing an issue when converting a Word document to PDF. Specifically, there is a formatting error in the table of contents (TOC).

In the TOC, for point 6, the dots (“…”) between the title and the page number are missing after the conversion. This issue only appears in the PDF version, while the original Word document displays the TOC correctly.

Thank you for your support.

Best regards,
Emre Kaya
Ticket 428.docx (64,3 KB)

Ticket 428.pdf (2,6 MB)

@emrekaya58 Unfortunately, I cannot reproduce the problem on my side using the latest 24.7 version of Aspose.Words. As I can see PDF produced by Aspose.Words looks the same as PDF produced by MS Word.
Aspose.Words: out.pdf (70.2 KB)
MS Word: ms.pdf (113.4 KB)

var saveOptions = new Aspose.Words.Saving.PdfSaveOptions();
saveOptions.PageMode = PdfPageMode.UseOutlines;
saveOptions.OutlineOptions.DefaultBookmarksOutlineLevel = 1;
saveOptions.OutlineOptions.CreateMissingOutlineLevels = true;
saveOptions.OutlineOptions.CreateOutlinesForHeadingsInTables = true;
saveOptions.OutlineOptions.HeadingsOutlineLevels = 6;
saveOptions.OutlineOptions.ExpandedOutlineLevels = 1;
saveOptions.HeaderFooterBookmarksExportMode = Aspose.Words.Saving.HeaderFooterBookmarksExportMode.All;
saveOptions.CreateNoteHyperlinks = true;
saveOptions.EmbedAttachments = true;
saveOptions.EmbedFullFonts = true;
saveOptions.ExportDocumentStructure = true;
saveOptions.CustomPropertiesExport = Aspose.Words.Saving.PdfCustomPropertiesExport.Metadata;
saveOptions.UpdateFields = true;

can you check it please with this Options?

@emrekaya58 The problem is still not reproducible. Here is the output PDF document produced with the above save options: out.pdf (1.8 MB)

Hi,

I have identified the issue we discussed earlier. It appears to be a bug in the Aspose system. Could you please test the scenario again using the following method call in your code?

var document = new Document(sourceFile);
document.UpdateFields();
document.Save(targetFile, saveOptions);

By including the document.UpdateFields(); method.

Best regards,
Emre Kaya

@emrekaya58 Thank you for additional information. I have managed to reproduce the problem with Document.UpdateFields() method. By the way, it is normally is not required to call this method before saving document as PDF. Aspose.Words automatically update fields upon rendering the document.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-27224

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like