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

Free Support Forum - aspose.com

Html with js to Image not working

Hi team,
Good Day.

I have a requirement , where in I have to convert an html file, having js, to image without rendering the html in the browser. Basically like a screenshot from a static html page which has js.

Does aspose support any such functionality ??
I found this code in the aspose forum , but it gives image of static html without JavaScript

Document doc = new 
       Document(ImageConvert.class.getResourceAsStream("index.html"));

        for (int page = 0; page < doc.getPageCount(); page++)
        {
            Document extractedPage = doc.extractPages(page, 1);
            extractedPage.save(String.format("Output_%d.jpg", page + 1));
        }

        } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }

@mrajgopal.22 Unfortunately, Aspose.Words does not support JavaScript in HTML.

Thanks for replying.

Is there any other aspose product which can help in achieving the requirement?

@mrajgopal.22 You can consider using Aspose.HTML, but I am not sure whether it support JavaScript. You can ask in the appropriate forum.

Thanks for replying.
Okay Sure.

1 Like