Browse our Products

If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.


Docs Swagger Examples Blog Support Release Notes Dashboard

Installation

The package is available at pypi.org and it can be installed via pip by executing following command:

pip install asposehtmlcloud

PyPI - Version PyPI - Downloads Python-asposeCloud


Aspose.HTML Cloud SDK for Python

Aspose.HTML Cloud SDK for Python provides a robust solution for processing HTML documents and acts as a Python wrapper around the REST API, taking on numerous low-level operations: authentication, endpoint management, request/response handling, etc. Currently, the Cloud SDK for Python offers a number of key features:

  • Conversion of HTML and HTML-based documents into various other formats.
  • Image Vectorization.
  • Management of storage operations.

Convert HTML, MHTML, XHTML, EPUB, Markdown, and SVG

  • Convert HTML & XHTML to PDF, DOCX, XPS, MHTML, Markdown, and images.
  • Convert MHTML, EPUB, Markdown, and SVG to PDF, XPS, images, etc.
  • Process input from local files, URLs, or cloud storage.
  • Adjust advanced options such as page setup, resolution, etc.

Image Vectorization

  • Convert raster images to SVG vector graphics.
  • Create high-quality vector images from low-resolution sources.
  • Adjust vectorization settings for precise results.

HTML Files Cloud Storage Features

  • Upload, download, copy, move, and delete files, including version control.
  • Create, copy, move, and delete folders.
  • Copy and move files and folders between separate storages in a single operation.
  • Check the existence of a specific file, folder, or storage.

Supported File Formats

Format  DescriptionLoadSave  Remarks
HTMLHTML format✔️✔️
XHTMLHTML with XML syntax✔️✔️Save option is only available when the input file is XHTML
MHTMLMHTML (Web archive) format✔️✔️Save option is only available for an MHTML document saving
EPUBE-book file format✔️
MDMarkdown Format✔️✔️Save option is only available for an HTML document saving
PDFSaves a document in PDF format✔️
XPSSaves a document in XPS (XML Paper Specification) format✔️
DOCXSaves a document in DOCX format✔️
TIFFRenders a page or pages of a document into TIFF✔️
JPEGRenders a page of a document and saves it as a JPEG file✔️
PNGRenders a page of a document and saves it as a PNG file✔️
BMPRenders a page of a document and saves it as a BMP file✔️
GIFRenders a page of a document and saves it as a GIF file✔️

Convert HTML to PDF

This Python example demonstrates how to use the Aspose.HTML Cloud SDK to convert a local HTML to PDF. The SDK is configured with your API credentials and endpoints. The conversion is executed through the HtmlApi client, and any API exceptions are caught and printed for debugging:

from asposehtmlcloud.configuration import Configuration
from asposehtmlcloud.api.html_api import HtmlApi
from asposehtmlcloud.api_client import ApiClient as Client
from asposehtmlcloud.rest import ApiException

# Configure Aspose.HTML Cloud API client
configuration = Configuration(
    apiKey="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    appSid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    basePath="https://api.aspose.cloud/v4.0",
    authPath="https://api.aspose.cloud/connect/token",
    debug=True
)

# Initialize API client
client = Client(configuration)

# Initialize HtmlApi client
html_api = HtmlApi(client)

try:
    # Convert local HTML file to PDF and save it locally
    res = html_api.convertApi.convert_local_to_local(
        input_file="test.html",  # Source HTML file
        output_file="test.pdf"   # Destination PDF file
    )
except ApiException as ex:
    # Handle errors from the API call
    print("Exception")
    print("Info: " + str(ex))
    raise ex

Check if a file exists in the storage

This Python example demonstrates how to use the Aspose.HTML Cloud SDK to check whether a file or folder exists in cloud storage. The code initializes the API client with configuration details, calls the object_exists method on the StorageApi, and prints the response. The result indicates whether the object exists and if it is a folder.

from asposehtmlcloud import Configuration, Client, StorageApi

# Configure Aspose Cloud API client
configuration = Configuration(
    basePath="https://api.aspose.cloud/v4.0",
    authPath="https://api.aspose.cloud/connect/token",
    apiKey="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    appSid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    debug=True
)

# Initialize API client
client = Client(configuration)

# Create Storage API instance
api = StorageApi(client)

# Check if the object exists in cloud storage
res = api.object_exists("fileInStorage.txt").to_dict()

# Extract existence and folder information
exist = res['exists']       # True if the object exists
is_folder = res['is_folder']# True if the object is a folder

# Print the full response
print(res)
 English