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

Free Support Forum - aspose.com

Convert PDF to HTML: hyperlinks

Is it possible to keep the hyperlinks (in a toc for example) during the converting pdf to HTML?

Hi Alex,

Thanks for your interest in our API’s.

The hyperlinks inside PDF file are honored when rendering it to HTML format. Please try using our API and in case you encounter any issue or you have any further query, please feel free to contact.


Document profileDocument = new Document(“c:/pdftest/input.pdf”);<o:p></o:p>

profileDocument.Save("c:/pdftest/sourceconverted.html", SaveFormat.Html);

Thanks for your request. Actually, I am using java… And in your documentation, there is:

profileDocument.Save(“c:/pdftest/sourceconverted.html”, SaveOptions);
Is it the same thing? If yes it is, I haven’t the hyperlinks when I browse the table of content…

Hi Alex,

Thanks for your feedback. Please check following code for Aspose.Pdf for Java, it should work for you. If issue persist then please share your sample PDF document here, we will look into it and will provide you information accordingly.

Document doc = new Document(myDir+"pdfwithlinks.pdf");

doc.save(myDir+"temp/pdfwithlinks.html", SaveFormat.Html);

Best Regards,

Thanks for your request. However, I still have an issue: the code doesn’t work. Eclipse asks me to initialize “myDir”, and then, I can’t compile…
My code:

import com.aspose.pdf.*;

public class Convert
public static void main(String[] args) throws Exception
String myDir = null;
Document doc = new Document(myDir+“D:/Documents/Docs_tests/MZ_3820/MZ_3820.pdf”);

doc.save(myDir+“D:/Users/T0163296/Documents/ALEXANDRA/Docs_tests/HTML.html”, SaveFormat.Html);

Hi ALex,

Thanks for your inquiry. We have tested PDF to HTML conversion with your shared PDF document and notice that it is not preserving TOC links in resultant HTML. So we have logged a ticket PDFNEWJAVA-34862 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

Moreover, in reference to your concern about sample code snippet, please note myDir is just a string variable that i used to hold the parent directory path. You can either set this variable to as per your system path or remove it and pass complete path of input and output files as following.

Document doc = new Document(“D:/Documents/Docs_tests/MZ_3820/MZ_3820.pdf”);<o:p></o:p>

doc.save("D:/Users/T0163296/Documents/ALEXANDRA/Docs_tests/HTML.html", SaveFormat.Html);

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFJAVA-34862) have been fixed in Aspose.Pdf for Java 17.5.

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