Convert HTML TO PDF hyperlInk issue

Hi, I am trying to convert html to pdf using the below code.

PDF is generated, however hyperlinks in the pdf are not clickable.
Questions :

  • How to make it clickable

  • How to display pagenumber in the converted pdf

// Get the response.
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        // Get the stream containing content returned by the server.
        Stream dataStream = response.GetResponseStream();
        // Open the stream using a StreamReader for easy access.
        StreamReader reader = new StreamReader(dataStream);
        // Read the content.
        string responseFromServer = reader.ReadToEnd();
        reader.Close();
        dataStream.Close();
        response.Close();

        MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseFromServer));
        HtmlLoadOptions options = new HtmlLoadOptions(Request.Url.ToString());
        options.PageInfo.IsLandscape = false;
        options.PageInfo.Height = Aspose.Pdf.PageSize.A4.Height;
        options.PageInfo.Width = Aspose.Pdf.PageSize.A4.Width;

        
        // Load HTML file
        Document pdfDocument = new Document(stream, options);
        


        MemoryStream ms = new MemoryStream();
        //doc.Save(ms);
        // Save output as PDF format
        pdfDocument.Save(ms);
        Response.Clear();
        Response.ClearHeaders();
        Response.ClearContent();
        Response.Charset = "UTF-8";
        Response.AddHeader("content-length", ms.Length.ToString());
        Response.AddHeader("content-disposition", String.Format("attachment;filename=TestDocument.pdf", "FileName"));
        Response.ContentType = "application/pdf"; Response.BinaryWrite(ms.ToArray());
        Response.Flush();
        Response.End();
i

@anurax

Would you please share the URL string from which you are downloading HTML for conversion. We will test the scenario in our environment and address it accordingly.

Once the PDF file is generated, you can add stamp in its pages for page numbers. Please check following article(s) in API documentation for more information: