.NET 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.
Aspose.HTML-Cloud
Aspose.HTML.Cloud.SDK.Examples
Aspose.HTML.Cloud.Sdk.Tests
Data
Settings
TestData
docs
.gitignore
Aspose.HTML.Cloud.Sdk.sln
LICENSE
Local.testsettings
README.md

README.md

Aspose.HTML Cloud SDK for .NET NuGet

This repository contains Aspose.HTML Cloud SDK for .NET source code. This SDK allows you to work with Aspose.HTML Cloud REST APIs in your .NET applications quickly and easily, with zero initial cost.

Key Features

  • Conversion of HTML document into various formats; PDF, XPS document formats and JPEG, PNG, BMP, TIFF raster graphics formats are supported
  • Conversion of MHTML document into the same formats that are supported for HTML
  • Merging HTML/XHTML templates with external data source; XML is supported as source data format
  • Translation of HTML document between various human languages; the following language pairs are currently supported:
  • English to German
  • English to French
  • English to Russian
  • German to English
  • Russian to English
  • English to Chinese
  • Extraction of HTML fragments using XPath queries
  • Extraction of HTML fragments using CSS selectors
  • Extraction of all HTML document images in a ZIP archive
  • Recognition of text content of an image using the OCR service and its import into HTML document.
  • Recognition of text content of an image, import into HTML document with further translation to other languages.
  • Detection of keywords in the HTML text content.

See API Reference for full API specification.

How to use the SDK?

The complete source code is available in this repository folder. You can either directly use it in your project via source code or get NuGet distribution (recommended). For more details, please visit our documentation website.

Prerequisites

To use Aspose HTML for Cloud .NET 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.

Installation

Install Aspose.HTML-Cloud via NuGet

From the command line:

nuget install Aspose.HTML-Cloud

From Package Manager:

PM> Install-Package Aspose.HTML-Cloud

From within Visual Studio:

  1. Open the Solution Explorer.
  2. Right-click on a project within your solution.
  3. Click on Manage NuGet Packages...
  4. Click on the Browse tab and search for "Aspose.HTML-Cloud".
  5. Click on the Aspose.HTML-Cloud package, select the appropriate version in the right-tab and click Install.

Run tests and examples.

To run tests, first modify the Settings\servercreds.json file setting up your AppSID & AppKey that you have obtained before (see Prerequisites) and basePath if it differs from http://api.aspose.cloud.

To run examples, modify the Aspose.HTML.Cloud.SDK.Examples\App.config file setting up AppSID, AppKey, and optionally DataPath.

Sample usage

The example below shows how your application have to translate the HTML document located by its URL using Aspose.HTML-Cloud library:

using System;
using System.IO;
using Com.Aspose.Storage.Api;
using Com.Aspose.Storage.Model;
using Aspose.Html.Cloud.Sdk.Api;

namespace MyAppNamespace
{
    public class Example
    {
        string APPKEY = "XXXXXXX"; // put here the app Key
        string APPSID = "XXXXXXX"; // put here the app SID
        string BASEPATH = "https://api.aspose.cloud/v.1.1";

        string sourceUrl = "https://www.le.ac.uk/oerresources/bdra/html/page_02.htm";
        // 
        string source_lang = "en";  // source language
        string result_lang = "fr";  // result language

        string resultFile = "page_02_en_fr.htm";

        static void Main(string[] args)
        {
            // create instance of the API class
            ITranslationApi trApi = new TranslationApi(APPKEY, APPSID, BASEPATH);
            // translate the HTML document by its URL
            Stream stream = trApi.GetTranslateDocumentByUrl(sourceUrl, source_lang, result_lang);
            // copy result to file 
            using (FileStream fs = new FileStream("page_02_en_fr.htm", FileMode.Create, FileAccess.Write))
            {
                stream.Position = 0;
                stream.CopyTo(fs);
                fs.Flush();
            }
        }
    }
}

Dependencies

Roadmap

Known issues that we are set to fix soon:

  • Get supported language pairs - issue of Aspose.HTML.Cloud; will be fixed in the next versions.

In the upcoming releases, we are set to implement a number of new features:

  • Add more language pairs to translate: French-to-English, English-to-Japanese, Japanese-to-English and some others.
  • Improve quality of translation.

Documentation for API Endpoints

All URIs are relative to https://api.aspose.cloud/v1.1

Class Method HTTP request Description
ConversionApi GetConvertDocumentToImage GET /html/{name}/convert/image/{outFormat} Convert the HTML document from the storage by its name to the specified image format.
ConversionApi GetConvertDocumentToImageByUrl GET /html/convert/image/{outFormat} Convert the HTML page from the web by its URL to the specified image format.
ConversionApi GetConvertDocumentToPdf GET /html/{name}/convert/pdf Convert the HTML document from the storage by its name to PDF.
ConversionApi GetConvertDocumentToPdfByUrl GET /html/convert/pdf Convert the HTML page from the web by its URL to PDF.
ConversionApi GetConvertDocumentToXps GET /html/{name}/convert/xps Convert the HTML document from the storage by its name to XPS.
ConversionApi GetConvertDocumentToXpsByUrl GET /html/convert/xps Convert the HTML page from the web by its URL to XPS.
ConversionApi PutConvertDocumentToImage PUT /html/{name}/convert/image/{outFormat} Convert the HTML document from the storage by its name to the specified image format and save it to storage.
ConversionApi PutConvertDocumentToImage PUT /html/convert/image/{outFormat} Convert the HTML document from the request stream to the specified image format and save it to storage.
ConversionApi PutConvertDocumentToPdf PUT /html/{name}/convert/pdf Convert the HTML document from the storage by its name to PDF and save it to storage.
ConversionApi PutConvertDocumentToPdf PUT /html/convert/pdf Convert the HTML document from the request stream to PDF and save it to storage.
ConversionApi PutConvertDocumentToXps PUT /html/{name}/convert/xps Convert the HTML document from the storage by its name to XPS and save it to storage.
ConversionApi PutConvertDocumentToXps PUT /html/convert/xps Convert the HTML document from the request stream to XPS and save it to storage.
DocumentApi GetDocumentFragmentByXPath GET /html/{name}/fragments/{outFormat} Return list of HTML fragments matching the specified XPath query.
DocumentApi GetDocumentFragmentByXPathByUrl GET /html/fragments/{outFormat} Return list of HTML fragments matching the specified XPath query - from a Web page by its URL.
DocumentApi GetDocumentFragmentByCSSSelector GET /html/{name}/fragments/css/{outFormat} Return list of HTML fragments matching the specified CSS selector
DocumentApi GetDocumentFragmentByCSSSelectorByUrl GET /html/fragments/css/{outFormat} Return list of HTML fragments matching the specified CSS selector - from a Web page by its URL.
DocumentApi GetDocumentImages GET /html/{name}/images/all Return all HTML document images packaged as a ZIP archive.
DocumentApi GetDocumentImagesByUrl GET /html/images/all Return all HTML document images packaged as a ZIP archive - from a Web page by its URL.
TemplateMergeApi GetMergeHtmlTemplate GET /html/{templateName}/merge Populate HTML document template with data located as a file in the storage.
TemplateMergeApi PutMergeHtmlTemplate PUT /html/{templateName}/merge Populate HTML document template with data from the stream. Result document will be saved to storage.
TranslationApi GetTranslateDocument GET /html/{name}/translate/{srcLang}/{resLang} Translate the HTML document specified by the name from default or specified storage.
TranslationApi GetTranslateDocumentByUrl GET /html/translate/{srcLang}/{resLang} Translate the HTML document specified by its URL.
OcrApi GetRecognizeAndImportToHtml GET /html/{name}/ocr/import Recognize text content from the source image file by its name from default or specified storage, and create an HTML document.
OcrApi GetRecognizeAndTranslateToHtml GET /html/{name}/ocr/translate/{srcLang}/{resLang} Recognize text content from the source image file by its name from default or specified storage, and create an HTML document translated to the specified language.
SummarizationApi GetDetectHtmlKeywords GET /html/{name}/summ/keywords Detect keywords of the HTML document specified by the name from default or specified storage.
SummarizationApi GetDetectHtmlKeywordsByUrl GET /html/summ/keywords Detect keywords of the HTML document specified by its URL.

Resources

Contact Us

Your feedback is very important to us. Please feel free to contact us using our Support Forums.