We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Table of contents to PDF bookmarks

In my use of Aspose Words and Slides I need to convert doc/docx/ppt/pptx files to PDF
When those source files contain native table of contents built in Word or Powerpoint is it a way to add to the aspose generated PDF bookmarks to ‘reproduce’ the TOC feature ?

Any builtin or external (with code) idea?



Could you please ZIP and attach your input Word and PowerPoint documents along with expected output PDF files? We will then provide you more information about your query.

Basically here is a screenshot of a PPTX containing a native table of contents file transformed into PDF where a table of bookmarks have been created manually:

Bookmarks.png (590.4 KB)


With Aspose.Words, you can save the document to PDF with following PdfSaveOptions to export the Headings (bookmarks) into output PDF.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert headings of levels 1 to 5.
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;

builder.Writeln("Heading 1");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;

builder.Writeln("Heading 1.1");
builder.Writeln("Heading 1.2");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading3;

builder.Writeln("Heading 1.2.1");
builder.Writeln("Heading 1.2.2");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading4;


builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading5;


// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();

// Set the "HeadingxsOutlineLevels" property to "4" to exclude all headings whose levels are above 4 from the outline.
options.OutlineOptions.HeadingsOutlineLevels = 4;

options.OutlineOptions.ExpandedOutlineLevels = 2;
doc.Save(MyDir + "PdfSaveOptions.ExpandedOutlineLevels.pdf", options);

Regarding Aspose.Slides, we are moving this forum thread to Aspose.Total forum where you will be guided appropriately.


Can you please provide sample presentation file with us that we can observe on our end.

Will try it!
Will look if there is something for Slides too…

I will be looking forward for that.