im converting html documents to pdf using aspose.words and im trying to add anchortags to my table of content. Standard: <a href="#15548"> and <h2 id="15548" >
. it doesent work when i convert it to pdf, any work around for this ?
@henrikJohansen You can using the following syntax <a name="test">
to insert bookmark in HTML document. For example see the following HTML:
<html>
<body>
<div>
<p>
<span>Test</span><a name="test"></a><span> Test</span>
</p>
</div>
</body>
</html>
To preserve bookmarks in PDF, you should specify OutlineOptions.DefaultBookmarksOutlineLevel
:
Document doc = new Document(@"C:\Temp\in.html");
PdfSaveOptions opt = new PdfSaveOptions();
opt.OutlineOptions.DefaultBookmarksOutlineLevel = 1;
doc.Save(@"C:\Temp\out.pdf", opt);
out.pdf (15.2 KB)