Convert HTML code into PNG format images.
Request
Body Params  application/json
{
    "htmlCode": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>简单的HTML页面</title>\n    <style>\n        body {\n            background: linear-gradient(to right, #6a11cb, #2575fc);\n            display: flex;\n            justify-content: center;\n            align-items: center;\n            height: 100vh;\n            margin: 0;\n            font-family: Arial, sans-serif;\n            color: white;\n        }\n        h1 {\n            font-size: 3rem;\n            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);\n        }\n    </style>\n</head>\n<body>\n    <h1>这是个简单的HTML页面</h1>\n</body>\n</html>"
}
Request Code Samples
curl --location --request POST 'https://api.302.ai/v1/htmltopng' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "htmlCode": "<!DOCTYPE html>\n<html lang=\"zh-CN\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>简单的HTML页面</title>\n    <style>\n        body {\n            background: linear-gradient(to right, #6a11cb, #2575fc);\n            display: flex;\n            justify-content: center;\n            align-items: center;\n            height: 100vh;\n            margin: 0;\n            font-family: Arial, sans-serif;\n            color: white;\n        }\n        h1 {\n            font-size: 3rem;\n            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);\n        }\n    </style>\n</head>\n<body>\n    <h1>这是个简单的HTML页面</h1>\n</body>\n</html>"
}'
Responses
application/json Modified at 2024-09-19 06:32:08