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

Free Support Forum - aspose.com

Html to pdf conversion with bookmarks


I’m trying to perform a conversion from html to pdf but the bookmarks from the html input are not converted to output pdf.

The bookmarks in html input document are set like this:

Chapter 1

Could you please help me with this conversion? Any help will be really welcome…

Best regards,

Hi Maria,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your query. Would you please share some sample document/code so we will take a closer look into the issue and suggest you solution accordingly.

Best Regards,

Thanks for your response.

You can find attached the sample document I'm using as input. The code I'm using for the conversion is the following one:

case "html":

string html = File.ReadAllText("D:/ArchivosEjemplo/Inputs/InputMarcadores.html");

Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

pdf.IsBookmarked = true;



Thanks in advance, best regards


Hi Maria,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for sharing more information. Your query relates to our another product; Aspose.Pdf. So I’m moving your query to related forum, where one of my colleague will reply you soon.

Best Regards,

Hi Maria,

Thanks for using our products and sharing the sample source code and template document with us.

I tested the scenario and able to notice the same problem. For rectification, I logged this problem with ID: PDFNEWNET-33819 in our Issue Tracking System. We will further look into the details of this issue and will keep you updated via this forum thread on the status of correction.

We apologize for your inconvenience.

Thanks & Regards,


As bookmarks in conversion from html to pdf is not working properly, I'm trying to use another approach using sections and Aspose.Pdf.Generator.ListType.TableOfContents to generate a pdf document within it's Table of contents.

The problem I have now is related to Sections in the pdf document, I need to add the content of an html file inside the section of the pdf document, looking into the documentation I found this approach:

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

FileStream fstream;

fstream = new FileStream("D:/ArchivosEjemplo/Resultados/Doc/Example.html", FileMode.Open);

Aspose.Pdf.Generator.DocumentAttachment DocStreamAttachment = new Aspose.Pdf.Generator.DocumentAttachment();


DocStreamAttachment.DocumentAttachmentStream = fstream;

DocStreamAttachment.DocumentAttachmentContentType = "html";



But the content of the .html file is not loaded into the pdf file generated.

Could you please help me with this approach? Thanks in advance, best regards


Hi Maria,

Thanks for sharing the sample source code with us.

Can you please share the source HTML file (Example.html) so that we can test the scenario at our end. We apologize for your inconvenience.

Thanks & Regards,

The issues you have found earlier (filed as PDFNEWNET-33819) have been fixed in Aspose.Pdf for .NET 7.7.0.

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