File Conversion – Aspose.HTML Cloud
Contents
[
Hide
Show
]This article explains how to convert files using Aspose.HTML Cloud API in both synchronous and asynchronous modes. While this example demonstrates converting HTML to PDF, the API supports many other formats. You can convert between the following formats by simply changing the URL path:
- HTML Converter: Convert HTML to PDF, XPS, DOCX, JPEG, PNG, TIFF, BMP, GIF, Markdown, and MHTML.
- EPUB Converter: Convert EPUB to PDF, XPS, DOCX, JPEG, PNG, TIFF, BMP, and GIF.
- MHTML Converter: Convert MHTML to PDF, XPS, DOCX, JPEG, PNG, TIFF, BMP, and GIF.
- Markdown Converter: Convert Markdown to PDF, XPS, DOCX, JPEG, PNG, TIFF, BMP, and GIF.
- XHTML Converter: Convert XHTML to PDF, XPS, DOCX, JPEG, PNG, TIFF, BMP, and GIF.
- SVG Converter: Convert SVG to PDF, XPS, JPEG, PNG, TIFF, BMP, and GIF.
- Image Vectorization: Convert raster images to vector formats like SVG.
Before starting, make sure you have obtained an authorization token. See Authorization Guide for more information.
File Conversion Methods
Aspose.HTML Cloud offers two methods for file conversion:
- Synchronous Conversion: Suitable for small files, where the conversion request returns the converted file directly in the response.
- Asynchronous Conversion: Ideal for large files, where the conversion runs in the background, and you can download the file once the process is completed.
1. Synchronous File Conversion
Endpoint: POST https://api.aspose.cloud/v4.0/html/conversion/html-pdf/sync
Authorization: Bearer token
Request Body:
1{
2 "InputPath": "http://help.websiteos.com/websiteos/example_of_a_simple_html_page.htm"
3}
Response: The API returns the converted file directly.
2. Asynchronous File Conversion
Steps:
- Submit conversion request
- Check conversion status
- Download the converted file