Unnie
Unnie

Reputation: 937

Aspose HTML to PDF conversion- hyperlinks to content on same file not working

I am using AsposePDF for .Net version 17.3 for bulk conversion of lot of html files to PDF. I have an existing html file with hyperlinks to content in same file. Below is a sample of the html in the file. Link:

<a href="#bg880016">Section 5</a>

Content:

<a name="#bg880016"><p>section 5 content is here</p></a>

When this is converted to PDF the local links are not working anymore. Below is the conversion code:

public Stream ConvertHtmlToPDF(Stream inputStream, string docTitle)
{
    Stream pdfStream = new MemoryStream();
    inputStream.Position = 0;
    var options = new HtmlLoadOptions();
    var pdfDocument = new Aspose.Pdf.Document(inputStream, options);
    pdfDocument.Info.Title = docTitle;
    pdfDocument.Save(pdfStream);
}

Any help is much appreciated. I have also posted a question in their support forum.

Upvotes: 0

Views: 2103

Answers (1)

rory.ap
rory.ap

Reputation: 35270

I've found you need to convert it first to a Word document and then convert that to a PDF to get it to work as desired. Do you have Aspose.Words also?

Upvotes: 1

Related Questions