What is Cloud Render API?
Using Polotno SDK you can generate images directly on the client. But sometimes you need to generate images on the backend. For example if you want to generate a 1,000 images with different text on it or if you want to simply offload rendering work from the client.
You can render images on the backend using Polotno Node.js SDK. But it requires you to have your own backend infrastructure.
Polotno Cloud Render API allows you to generate images on the cloud without any backend infrastructure. You can use it to generate images on the fly or to generate images in bulk.
What does it look like?
Options
When you send request to the API, you need to pass JSON into request's body.
design
design
- JSON data from polotno export store.toJSON()
. Remember that you can generate such JSON on the fly from your backend (e.g. replace text on some elements dynamically).
outputFormat
outputFormat
- defines response format. Possible values are: dataURL
(default), url
and file
.
If you use dataURL
or url
, API will return json { url: '...' }
where url
is the generated image url.
file
format will return file buffer. You can save it directly on the backend.
⚠️ Important
Cloud API has 5mb limit for its payload!. So it will be not able to return large data in dataURL
or file
format. You can use url
format instead.
Images generated using url
format expire in 24 hours. After that time, access to the files is not guaranteed.
You will have to set up the infrastructure for storing files to guarantee the access.
format
File format of generated result. Possible values are: png
(default), jpeg
, pdf
.
exportOptions
Additional options to pass into export function. For more details see store.toDataURL() and store.toPDFDataURL().\
htmlTextRenderEnabled
Optional boolean value to enable Rich Text Feature
textVerticalResizeEnabled
Optional boolean value to enable Vertically Resized Text