HTML Rendering & Conversion C++ Cloud REST API
Aspose.HTML Cloud for C++ is a programming SDK that allows software developers to manipulate and convert HTML documents from within their own applications. A Wrapper of RESTful APIs, Aspose.HTML Cloud for C++ speeds up HTML programming and conversion. This cloud SDK assists to develop cloud-based HTML page rendering, processing, translation & conversion apps in C++ via REST API.
HTML Processing Features
- Fetch the HTML page along with its resources as a ZIP archive by providing the page URL.
- Based on page URL, retrieve all images of an HTML page as a ZIP package.
- Load data from a local file to populate the HTML document template.
- Use the request body to populate the HTML document template.
- Convert HTML page to numerous other file formats.
Read & Write HTML Formats
HTML, XHTML, zipped HTML, zipped XHTML, MHTML, HTML containing SVG markup, Markdown, JSON
Save HTML As
Fixed Layout: PDF, XPS Images: TIFF, JPEG, PNG, BMP, GIF Other: TXT, ZIP (images)
Read HTML Formats
eBook: EPUB Other: XML, SVG
Enhancements Version 20.11
-
New generation of Aspose.HTML Cloud SDK for .NET (C#) is provided.
-
This version of SDK has been redesigned from scratch being based on the new Aspose.HTML Cloud REST API (v3.0).
-
Currently, it provides only the conversion feature. Other features that are still available in the versions up to v.20.08 are planned to be implemented in this SDK later.
-
Conversion interface provides a more flexible conversion parameters setup.
-
Redesigned storage access is provided using SDK entry point HtmlApi.Storage.
-
Availability of synchronous and asynchronous file upload and download methods.
-
Asynchronous download provides the ability to get progress data for the longer downloads.
-
API version: 3.0
-
Package version: 20.8.0
Installation
Get ready package or build from source.
Install from command line
PM> Install-Package Aspose.Html-Cloud.Cpp -Version 20.8.0
Load from git
git clone https://github.com/aspose-html-cloud/aspose-html-cloud-cpp.git
cd aspose-html-cloud-cpp
Getting Started
To use Aspose HTML for Cloud SDK you need to register an account with Aspose Cloud and lookup/create App Key and SID at Cloud Dashboard. There is free quota available. For more details, see Aspose Cloud Pricing.
Convert HTML to PNG in C++
// Get your ClientId and ClientSecret from https://dashboard.aspose.cloud (free registration required).
const utility::string_t clientId = _XPLATSTR("MY_CLIENT_ID");
const utility::string_t clientSecret = _XPLATSTR("MY_CLIENT_SECRET");
const utility::string_t basePath = _XPLATSTR("https://api.aspose.cloud/v3.0");
const utility::string_t authPath = _XPLATSTR("https://api.aspose.cloud/connect/token");
//Helper directory with data for test
const utility::string_t testResult = _XPLATSTR("..\\testresult\\");
//Create configuration for authorization
std::shared_ptr<ApiConfiguration> apiConfig(new ApiConfiguration(clientId, clientSecret, basePath, authPath));
//Create client from configuration
std::shared_ptr<ApiClient> apiClient(new ApiClient(apiConfig));
//Create ConversionApi
ConversionApi *api = new ConversionApi(apiClient);
//Parameters for conversion
utility::string_t sourceUrl = _XPLATSTR("https://stallman.org/articles/anonymous-payments-thru-phones.html");
boost::optional<int32_t> width = 800;
boost::optional<int32_t> height = 1000;
boost::optional<int32_t> leftMargin = 20;
boost::optional<int32_t> rightMargin = 20;
boost::optional<int32_t> topMargin = 20;
boost::optional<int32_t> bottomMargin = 20;
boost::optional<int32_t> resolution = 300;
//Convert to png
auto result = api->getConvertDocumentToImageByUrl(sourceUrl, _XPLATSTR("png"),
width, height, leftMargin, rightMargin, topMargin, bottomMargin, resolution).get();
//Save result to files
std::ofstream saved_data(testresult + _XPLATSTR("ConvertResult.zip"), std::ios::out | std::ios::binary);
result.writeTo(saved_data);
saved_data.close();
delete api;
Documentation for API Endpoints
All URIs are relative to https://api.aspose.cloud/v3.0
Examples
Requirements (for build from source)
- C++11
- Boost
- C++ REST SDK
oauth
- Type: OAuth
- Flow: application
- Authorization URL: "https://api.aspose.cloud/connect/token"
- Scopes: N/A
Tests contain various examples of using the Aspose.HTML SDK.
All API in html format Documentation for Aspose.HTML Api SDK
Aspose.HTML Cloud SDKs in Popular Languages
.NET | Java | PHP | Python | Ruby | Node.js | Android | Swift | C++ | Go |
---|---|---|---|---|---|---|---|---|---|
GitHub | GitHub | GitHub | GitHub | GitHub | GitHub | GitHub | GitHub | GitHub | GitHub |
NuGet | Maven | Composer | PIP | GEM | NPM | Maven | Cocoapods | NuGet | Go.Dev |
Product Page | Documentation | API Reference | Code Samples | Blog | Free Support | Free Trial