C++ library for communicating with the Aspose.HTML Cloud API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
api
cpprest
docs/html
model
packages/Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn.1.8.0
pplx
test
testsource
x64/Debug
.gitignore
ApiClient.cpp
ApiClient.h
ApiConfiguration.cpp
ApiConfiguration.h
ApiException.cpp
ApiException.h
CMakeLists.txt
Doxyfile
HttpContent.cpp
HttpContent.h
IHttpBody.h
JsonBody.cpp
JsonBody.h
LICENSE.txt
ModelBase.cpp
ModelBase.h
MultipartFormData.cpp
MultipartFormData.h
OAuth2Token.cpp
OAuth2Token.h
Object.cpp
Object.h
OctetStreamBody.cpp
OctetStreamBody.h
README.md
aspose.html.sdk.sln
aspose.html.sdk.vcxproj
aspose.html.sdk.vcxproj.filters
aspose.html.sdk.vcxproj.user
doxygen_log.txt

README.md

Aspose HTML Cloud SDK C++

AsposeHtml - the C++ library for the Aspose.HTML Cloud API Reference

  • API version: 1.1
  • Package version: 1.0.1

Requirements

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/v1.1");
    const utility::string_t authPath = _XPLATSTR("https://api.aspose.cloud/oauth2/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/v1.1

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

Tests contain various examples of using the Aspose.HTML SDK.

Docs Documentation for Aspose.HTML Api SDK