HTML to Image API - Dart/Flutter Client
HTML to Image is an HTML to image API that renders HTML code into a high-quality PNG image. Paid plans add custom dimensions and JPEG or WebP output.
This is the Dart/Flutter client for the HTML to Image API.
Installation
Add this to your pubspec.yaml:
dependencies:
apiverve_htmltoimage: ^1.2.6
Then run:
dart pub get
# or for Flutter
flutter pub get
Usage
import 'package:apiverve_htmltoimage/apiverve_htmltoimage.dart';
void main() async {
final client = HtmltoimageClient('YOUR_API_KEY');
try {
final response = await client.execute({
'html': '<html><head><style>body { font-family: Arial; padding: 20px; } h1 { color: #333; }</style></head><body><h1>Hello World</h1><p>This is a sample HTML document converted to an image.</p></body></html>',
'width': 800,
'height': 600,
'format': 'png'
});
print('Status: ${response.status}');
print('Data: ${response.data}');
} catch (e) {
print('Error: $e');
}
}
Response
{
"status": "ok",
"error": null,
"data": {
"width": 800,
"height": 600,
"format": "png",
"imageName": "bf3d3d67-bc6e-477b-a916-560b895f8091.png",
"expires": 1789676439207,
"downloadURL": "https://storage.googleapis.com/apiverve/APIData/htmltoimage/bf3d3d67-bc6e-477b-a916-560b895f8091.png?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1789676439&Signature=Uw7imp8TVuygEgWhdLAmK8%2Byk0NoZmtdLEX9MrDHjlWDYyB28y7zbCxVuD%2BF%2F6Iij5zi%2FhvDoJnuhNT6a2Yl85gw5nWGt750Ai4gup46dQQt0vrsUpD99IPTfTh21DWd4WqE7VCWlIlou7WwNUn620WgWM3ScGi13dCB81Qyb4WuxrdcNal8WrUYX9nZ12h%2B7BZs65Tyw0V4StbvsYxXKqySkF4aQ8J1QbdhUny9WyptE3qNT%2FyM4m2%2F%2FJAOq32bQsSWj8%2BycWEhtifIgpJe4LTBBeqtHBePrIQSrYNRdOwhjaTzj%2BShSeox5wPztiaoRyi1DGIx4FIIstS2dAdQ6Q%3D%3D",
"htmlLength": 197
}
}
API Reference
- API Home: HTML to Image API
- Documentation: docs.apiverve.com/ref/htmltoimage
Authentication
All requests require an API key. Get yours at apiverve.com.
License
MIT License - see LICENSE for details.
Built with Dart for APIVerve
Libraries
- apiverve_htmltoimage
- HTML to Image API client for Dart/Flutter