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

Free Support Forum - aspose.com

HTML "Back to Top" hyperlink can't work in PDF

Hello,

I have a urgent problem.
I use Aspose to convert HTML to PDF.
I set some hyperlinks in my HTML file.
When I convert HTML to PDF,
In webbrowser, I can search top to down, and also can back to top.
In PDF file, I can search top to down, but I can’t back to top.
Here are my sample of HTML source code:


test1紀錄
 
test2紀錄
 
test3紀錄
 

<a name='test1>test1
 
aaaaaaaaaaaaaaa
go top

test2
 
bbbbbbbbbb
go top

test3
 
ccccccccc
go top




How can I solve this problem?
Please give me the answer as soon as possible.
Thanks a lot.

Hi there,


Thanks for your inquiry. I am afraid I am getting an exception when converting your Html to PDF using Aspose.Pdf for .NET 9.3.0. We will appreciate if you please share your sample code and Aspose.Pdf API version that you are using, so we will investigate the issue further and provide you information accordingly.


HtmlLoadOptions htmloptions
= new HtmlLoadOptions();<o:p></o:p>

// use the new conversion engine

htmloptions.UseNewConversionEngine = true;

// load HTML file

Document doc = new Document("SampleHtml.html", htmloptions);

// Save HTML file

doc.Save("output.pdf");


Please feel free to contact us for any further assistance.


Best Regards,

Hi,
Thanks for your answer.
I'm using Aspose.Pdf API version for 8.1.0, ,NET Framework 4.0 , and vb.net.
There are my sample code:

Dim pdf As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf()
'Here put my license.

Dim section As Aspose.Pdf.Generator.Section = pdf.Sections.Add()
Dim r As StreamReader = File.OpenText(gvHtmStr)
Dim text2 As Aspose.Pdf.Generator.Text = New Aspose.Pdf.Generator.Text(section, r.ReadToEnd())
text2.IsHtmlTagSupported = True
text2.TextInfo.FontName = "標楷體"
text2.IfHtmlTagSupportedOverwrightHtmlFontNames = True
section.Paragraphs.Add(text2)

section.PageInfo.Margin.Left = 40
section.PageInfo.Margin.Right = 40
pdf.SetUnicode()
pdf.Save(afileName)
Return pdf



Please give me a hand as soon as possible.
Thanks a lot.

Hi 婷鈺,


Thanks for contacting support.

Adding more to Tilal’s comments, I have again tested the scenario with Aspose.Pdf for .NET 9.3.0 in VisualStudio 2012 project with target platform as .NET Framework 4.0 and as per my observations, the PDF file is properly being generated. As per my understanding, the hyperlinks are properly appearing in PDF and I am able to select them. However I am not able to understand the problem which you are facing. Can you please take a look over attached PDF file and share some details regarding the issue which you are facing. We are sorry for your inconvenience.

[C#]

HtmlLoadOptions htmloptions = new HtmlLoadOptions();<o:p></o:p>

// use the new conversion engine

htmloptions.UseNewConversionEngine = true;

// load HTML file

Document doc = new Document("c:/pdftest/SourceFile_Converted.html", htmloptions);

// Save HTML file

doc.Save("c:/pdftest/SourceFile_Converted_output.pdf");