Link Search Menu Expand Document

Render when ready

Control exactly when your image gets rendered.


The render_when_ready parameter allows you total control over when the API generates the image for you.

Set the parameter to true and the API will wait to generate the screenshot until it sees an element on the page with the ID HCTIReadyNow.

to call the JavaScript function ScreenShotReady() before it generates the image.

JavaScript Helper

For images generated with HTML/CSS (this does not work for URL to Image, we have added a helper function ScreenshotReady().

Once ScreenshotReady() is called, an element with HCTIReadyNow will be added to the page. This will trigger the API to generate the image.

<div>Hello, world.</div>

<script>
  setTimeout(function(){ ScreenshotReady() }, 2000);
</script>

This will call ScreenshotReady() after 2 seconds. Delaying the API from generating the image.

Using with URL to Image

When using URL to Image, you can trigger the rendering of the image by placing an element on the page with the ID HCTIReadyNow.

The JavaScript helper is not available for URL to Image, since we do not have full control over the page.

When to use this

This parameter is most useful for images with complex JavaScript and you need the image generated at a specific time.

For most images, this will not be needed and the API will automatically take the image once all of the HTML is done loading.

Alternatively, the ms_delay parameter could be useful to you. It allows you to set a specific amount of time before the image is generated.


Need help?

Talk to a human. Please email us support@htmlcsstoimage.com with any questions and we’ll gladly help you get started.


Back to top

Built with extensive integration tests and serious care for developer happiness.
© 2018-2024 Code Happy, LLC.

Page last modified: Dec 19 2024 at 03:17 PM.

Edit this page on GitHub.