HTML Content to PNG – Aspose.HTML Cloud

This guide demonstrates how to convert HTML content directly into PNG images using Aspose.HTML Cloud API. In addition to PNG, the API supports converting HTML content into several other image formats:

Ensure you have obtained your authorization token before proceeding. Refer to our Authorization Guide.


HTML Content Example

Here’s the HTML content we’ll use for conversion:

1<html>
2  <body>
3    <h1>Aspose.HTML Cloud</h1>
4    <p>This is an example of HTML content conversion to PNG.</p>
5  </body>
6</html>

API Request

Endpoint: POST https://api.aspose.cloud/v4.0/html/conversion/html-png/sync

Request Body:

1{
2  "InputContent": "<html><body><h1>Aspose.HTML Cloud</h1><p>This is an example of HTML content conversion to PNG.</p></body></html>"
3}

Example Implementation


Convert to Other Image Formats

To convert HTML content to other supported image formats, simply replace the output format (html-png) in the endpoint URL with your desired format:

See Also