Aspose angular Website to HTML using java

We are planning to convert webpage url to HTML as per our requirement.
For example we have web page url : JDK 21 Documentation - Home
that convert into HTML with .html page using java.

When we go through the ASPOSE API, we came to know that it will possible using below code snippet using java but it’s not working:

com.aspose.html.HTMLDocument document = new com.aspose.html.HTMLDocument(" https://docs.oracle.com/en/java/javase/21");
// Write the document content to the output stream
System.out.println(document.getDocumentElement().getOuterHTML());

Thanks

@kalpeshAspose1997

Can you please share what type of issue are you facing? Are you seeing some error or there is an expected output? Please note that we are already in a process of upgrading the API for such functionality and we need your complete feedback in order to do further analysis.

Hello @asad.ali
I have html page that contain javascript, that contain below code :
image.png (7.4 KB)

output in browser of above code
image.png (4.3 KB)

that’s the same file html content display in docx using aspose
image.png (3.1 KB)
it’s not showing same as a display in browser, so is there any way to enabled Javascript ?

thanks

@kalpeshAspose1997

Please try to use below code snippet in order to get the HTML content with executed JS and then you can convert it into other type of file format(s):

using HTMLDocument htmlDocument = new HTMLDocument(@"X:\source.html");
var options = new HTMLSaveOptions { SerializeInputValue = true };
htmlDocument.Save(@"x:\processed.html", options);

@asad.ali is there any way to create html page from url (the url has been created by angular project) using java?

@kalpeshAspose1997

Is it the URL of some live site? Or you are making it from a local project and downloading its HTML source?

Is it the URL of some live site? - Yes
you are making it from a local project and downloading its HTML source? - Yes

@kalpeshAspose1997

Can you please share that URL with us? Also, please share the output PDF along with the details of the issues that you are currently facing during conversion. We will test the scenario in our environment and address it accordingly.