- Docs
- Parameters
- render_when_ready
render_when_ready
Control exactly when your image gets rendered.
How it works
Section titled “How it works”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.
JavaScript helper
Section titled “JavaScript helper”For images generated with HTML/CSS, you can call the helper function ScreenshotReady(). This helper does not work for URL to Image.
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
Section titled “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
Section titled “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. Email support@htmlcsstoimage.com and we’ll help you get started.