Aspose HTML Cloud SDK C++
AsposeHtml - the C++ library for the Aspose.HTML Cloud API Reference
- API version: 3.0
- Package version: 19.5.0
Requirements
- C++11
- Boost
- C++ REST SDK
Installation
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.
const utility::string_t clientId = _XPLATSTR("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
const utility::string_t clientSecret = _XPLATSTR("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
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.png"), std::ios::out | std::ios::binary);
result.writeTo(saved_data);
saved_data.close();
delete api;
For use SDK see examples in test
Documentation for API Endpoints
All URIs are relative to https://api.aspose.cloud/v3.0
Aspose HTML includes Aspose.Storage.Cloud to manipulate files on a remote server. This is used in tests for download test files to the server.
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.
Docs Documentation for Aspose.HTML Api SDK