logo

IMAGE

Image API consist of HTML TO IMAGE, PDF TO IMAGE

1:HTML TO IMAGE

A module that converts HTML TO IMAGE, enabling seamless transformation of HTML into IMAGE.

Convert HTML File URL to Image


Method: POST
URL: /html-to-image
Headers: Content-Type: application/json

Body Parameters

Attribute Description Type Required Options
url HTML File URL text true
image_file_name File name, including extension, e.g. invoice.png text false
image_format Default: `png` text false PNG
JPG
BMP
image_quality Image quality `0-100`\nDefault: `100` uinteger false
image_width Image width e.g. `800`\nDefault: `800` number false
image_height Image height e.g. `0` (0 to maintain aspect ratio)\nDefault: `0` number false

Example Request

curl -X POST 'https://pdf.msquare.pro/html-to-image?appName=DocCrafter' \
 -H 'content-type: application/json' \
 -H 'authorization: YOUR_TOKEN_HERE' \
 -d '{"url":"https://www.rapidtables.com/web/html/link/test_file.html","file_name":"invoice.png","image_width":100,"image_format":"png","image_h"}'

Convert HTML to Image Using raw HTML data

Method: POST
URL: /html-to-image
Headers: content-type: text/html

Query Parameters

Attribute Description Type Required Options
image_file_name File name, including the ending, e.g. invoice.png text false
image_format Default: `png` text false PNG
JPG
BMP
image_quality Image quality `0-100`\nDefault: `100` uinteger false
image_width Image width e.g. `800`\nDefault: `800` number false
image_height Image height e.g. `0` (0 to maintain aspect ratio)\nDefault: `0` number false

Body - Request body will contain raw HTML data

Example Request

curl -X POST 'https://pdf.msquare.pro/html-to-image?appName=DocCrafter&image_width=100&image_format=png&image_height=100&image_quality=100&image_file_name=invoice.png' \
-H 'content-type: text/html' \
-H 'authorization: ***' \
-d '<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Request Conditions</title>
</head>

<body>

    <h1>Request Conditions</h1>

    <h2>Notes</h2>
    <ul>
      
        <li>Handle errors gracefully and check the response status code for success or failure (e.g., 200 OK, 400 Bad Request).</li>
    </ul>

</body>

</html>'

2:PDF TO IMAGE

This API allows you to convert PDF files to images. The conversion process supports two input types: PDF file provided as a URL and PDF file provided as raw file data

Request

1.Convert PDF from URL

Available Method
Method: POST
URL: /convertPDFToImage
Headers: Content Type: application/x-www-form-urlencoded

Query Parameters

Attribute Description Type Required
fileURL URL of the PDF file text true
pdf_password Enter the password if pdf is password protected. text false

Example Request


curl -X POST 'https://pdf.msquare.pro/convertPDFToImage?appName=DocCrafter&fileURL=https://www.africau.edu/images/default/sample.pdf' \
 -H 'authorization: YOUR_TOKEN_HERE' \
 -H 'content-type: application/x-www-form-urlencoded' \
 -d '{}'

2.Convert PDF to Image from PDF File Data

Available Method
Method: POST
URL: /convertPDFToImage
Type: json
Headers: Content-Type: multipart/form-data

Body Parameters

Field Type Description
file (required) file The PDF file to be converted.
pdf_password string Password for password-protected PDFs (optional).

Notes

Feel free to contact our support team for any issues or inquiries.