Add HTML string in PDF using Aspose.PDF for .NET - Anchor tag is not working in PDF output

Hi

I am having an issue with the Aspose PDF convertion… Aspose PDF is failing to load the anchor tag in the last pages…

For example : If there are 3 pages and all 3 are containing different different Hyperlinks in each pages, then when i export the Aspose PDF, i am unable to view the last pages Hyper links…i.e., on page 3…

If i reduce pages to 2 then problem is occurring in page 2… i.e., all times My aspose pdf is failing to load the hyperlink / Anchor tag "<a href = " in the last pages… How can I resolve this…

Regards,

Aravind

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

Please share your template PDF file with sample code to help us reproduce the issue at our end.

Sorry for the inconvenience,

Hi, I experiance the same problem with aspose 9.3. I try to convert html to pdf.


code looks like this:

the link: 2
the anchor:

any ideas?

Hi Jonas,


Thanks for your inquiry. Please use new DOM approach of HTML to PDF conversion for href tags rendering. It will help you to accomplish the task. However we have noticed it is adding an extra box around the link in output PDF file in Aspose.Pdf for .NET 9.4.0. So logged an investigation ticket as PDFNEWNET-37198 for its rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience caused.

Best Regards,

Will there be a Nuget release for that fix? Currently there is only 9.3 available in nuget.


Jonas

P.S. the html approach you sent works. The PDF files get very big though, why is that? We used the text approach and allowed html. the resulting pdf file was 2mb out of 3 mb html. not we get 91kb pdf out of 4kb html.

Jonas

jonas.hartwig:
Will there be a Nuget release for that fix? Currently there is only 9.3 available in nuget.
Hi Jonas,

The NuGet package for Aspose.Pdf for .NET 9.4.0 is published. Please get the latest package and in case you still face any problem, please feel free to contact.

jonas.hartwig:
P.S. the html approach you sent works. The PDF files get very big though, why is that? We used the text approach and allowed html. the resulting pdf file was 2mb out of 3 mb html. not we get 91kb pdf out of 4kb html.
Can you please share the above mentioned 4KB HTML file so that we can test the conversion at our end. We are sorry for your inconvenience.

The recommended changes worked fine. Thanks. However with the specified anchor tags i create a link to a different file:
- file:///


What am i missing?

Anchor

Hi Aravind,


I have tested the scenario using Aspose.Pdf for .NET 9.4.0 where I have used following code snippet and as per my observations, the resultant file contains hyperlink. Can you please share some details regarding the issue which you are facing. If possible, please share the resource HTML as it will help us in further understanding this problem.

[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/Research+Report.html", htmloptions);

doc.Save("c:/pdftest/Research+Report_HTMLtoPDFDOM.pdf");


[HTML]

<a href="#5" target="_self">Anchor

<a id="5" name="5">

<o:p></o:p>

The pdf file is attached. THe html source code would be: (i removed the styling information)

We use the exact .NET source code you provided. I open the pdf with Adobe Reader 10.1.10

Jonas’ Report

Jonas’ Report

Cision Quality Assurance Customer

MEDIA GROUP: Internet

( 1 ITEMS )

Unidentified Blog: Nordic Nanovector: Betalutin™ granted Orphan Designation in Europe

[3]

MEDIA GROUP: Internet

( 1 ITEMS )

Unidentified Blog Nordic Nanovector: Betalutin™ granted Orphan Designation in Europe

06-11-14

MEDIA TYPE: Blogs

REACH: ?

TEXT SNIPPET:

quality of life of people who suffer from non-Hodgkin Lymphoma (NHL). This information was brought to you by Cision http://new

LOCATION: what is location?

PUBLICATION VALUE: $? USD

SOURCE URL:

Hi Aravind,


Thanks for sharing the details.

I have tested the scenario using Aspose.Pdf for .NET 9.4.0 where I have first updated the HTML contents to refer/point to a valid file present over system and when selecting the link inside PDF document, the respective file is being displayed/viewed.

<a href="#TestPdf.pdf">3

I case I am unable to understand the issue, please share some more details. We are sorry for this inconvenience.

Yes I understand. But we want to have a link inside the document to another page. not to another file in the same folder.


regards

Is there any advice you can give on how to produce relative links inside the document.

jonas.hartwig:
Yes I understand. But we want to have a link inside the document to another page. not to another file in the same folder.
Hi Aravind,

Thanks for sharing the details.

I have tested the scenario and have observed that when selecting anchor link in PDF file, it’s not opening / directing to respective section in PDF file. Instead its trying to open a file in same folder where resultant PDF is generated. For
the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-37213. We will
investigate this issue in details and will keep you updated on the status of a
correction.

We apologize for your inconvenience.

Hi Aravind,


As a workaround, once the PDF file is created, you can place AnnotationLink in PDF file which will point to page in same document. For further details, please visit Create Local Link in Existing PDF File (Facades)

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as PDFNET-37213) have been fixed in Aspose.PDF for .NET 20.1.