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

Free Support Forum - aspose.com

HTML to image conversion taking minutes to finish


I’m trying to convert HTML layouts into images using the Converter.convertHtml function. Below is the code snippet i’m using.

def width = 4
def height = 1

final def html = """<html><head><link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet"></head><body><div class="ql-editor" style="background-color: #ffffff; height: 230px; font-family: sans-serif; overflow-y: hidden"><p class="ql-align-center"><strong>QWERTYUIOP</strong></p><p class="ql-align-center"><strong>ASDFGHJKL</strong></p><p class="ql-align-center"><strong>ZXCVBNM</strong></p></div></body><html>"""

// Initialize an HTML document
final document = new HTMLDocument(html, ".")

final streamProvider = new MemoryStreamProvider()

try {
    ImageSaveOptions options = new ImageSaveOptions(ImageFormat.Png);
    PageSetup pageSetup = new PageSetup();
    Page anyPage = new Page();
                    new Size(
                            Length.fromPixels(width * 420),
                            Length.fromPixels(height * 230)

     // Convert HTML to Image by using the MemoryStreamProvider
    Converter.convertHTML(document, options, streamProvider.lStream)

The MemoryStreamProvider class is taken from the sample provided in link

It’s taking minutes to execute; especially the HtmlDocument construction. Is this behavior expected or is there something else going on? Since this happens every time & we may need to convert 4-5 HTML codes, it’s causing significant performance issue in our system.

Help much appreciated.

Aspose.HTML version: 21.3
System: Ubuntu LTS 18.04.5
Specifications: ntel® Core™ i7-9700 CPU @ 3.00GHz × 8


Please try to increase the Java Heap Size if it helps. In case issue still persists, please share your sample HTML in .zip format with us along with the information of time taken by the API. We will test the scenario in our environment and address it accordingly.


Increasing the heap size doesn’t seem to help. I ran the conversions again and go the same results.

HTML attached.

The timing to convert this HTML code to image for different HTML codes is as follows:
HTMLs.zip (1.3 KB)

  • 3 s`
  • 100 s
  • 100 s

Heap size used: 8 GB


We were able to notice the issue in our environment while testing the scenario with 21.3 version of the API. Therefore, we have logged a ticket as HTMLJAVA-792 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Could you let us know if there’s any sort of tentative date of when a fix for this might land if possible?


We are porting all features and classes from .NET API to Aspose.HTML for Java at the moment and performance of the API is expected to be improved very much after the porting is done. The task is time taking and we are afraid that we cannot share any reliable ETA at the moment before your ticket is fully investigated. However, we have recorded your concerns and will surely update you once we have additional information in this regard. Please give us some time.

We are sorry for the inconvenience.

Any updates on the progress if possible?

We’re waiting on a possible fix to land a feature in our app. Any updates will be appreciated.


We are afraid that there are no updates at the moment as the work of porting .NET features into Java API is not yet done. We will update you once we have some news in this regard. We appreciate your patience in this matter. Please spare us some time.

Any updates on the port? Any news is appreciated.



We are afraid that no significant progress is made towards completion of the porting. The work is still under process. However, we will surely inform you once we have some updates in this regard.

We apologize for the inconvenience.

Could you please share any updates on the task?

Any info is appreciated.



We regret to inform that no updates are available at the moment as porting is not done yet. We will inform you once we have additional information in this regard. We apologize for the inconvenience and delay.