Last active
November 7, 2018 14:31
-
-
Save aspose-cloud/672d14709755580825217c6484c523a0 to your computer and use it in GitHub Desktop.
The GIST contains .NET Examples of Aspose.HTML Cloud APIs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The GIST contains .NET Examples of Aspose.HTML Cloud APIs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
// First upload source file to Cloud Storage as explained here | |
// https://docs.aspose.cloud/display/storagecloud/Upload+File+to+Aspose+Cloud+Storage | |
string name = "testpage1.html"; | |
string folder = null; | |
SummarizationApi summarizationApi = new SummarizationApi(appKey, appSID, basePath); | |
var stream = summarizationApi.GetDetectHtmlKeywords(name, folder, null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
// First upload source file to Cloud Storage as explained here | |
// https://docs.aspose.cloud/display/storagecloud/Upload+File+to+Aspose+Cloud+Storage | |
string name = "testpage5.html.zip"; | |
string folder = null; | |
string storage = null; | |
Aspose.Html.Cloud.Sdk.Api.DocumentApi documentAPI = new Aspose.Html.Cloud.Sdk.Api.DocumentApi(appKey, appSID, basePath); | |
Stream stream = documentAPI.GetDocumentImages(name, storage, folder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
var sourceUrl = @"https://www.le.ac.uk/oerresources/bdra/html/page_02.htm"; ; | |
SummarizationApi summarizationApi = new SummarizationApi(appKey, appSID, basePath); | |
var stream = summarizationApi.GetDetectHtmlKeywordsByUrl(sourceUrl); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
string name = "testpage5.html.zip"; | |
string csssel = "p"; | |
string folder = "HtmlTestDoc"; | |
string storagePath = $"{folder}/{name}"; | |
string srcPath = Path.Combine(dataFolder, name); | |
using (Stream fstr = new FileStream(srcPath, FileMode.Open, FileAccess.Read)) | |
{ | |
PutCreateRequest reqCr = new PutCreateRequest(storagePath, fstr); | |
this.StorageApi.PutCreate(reqCr); | |
GetIsExistRequest reqExist = new GetIsExistRequest(storagePath); | |
FileExistResponse resp = this.StorageApi.GetIsExist(reqExist); | |
Assert.IsTrue(resp.FileExist.IsExist.HasValue && resp.FileExist.IsExist.Value); | |
} | |
Stream stream = DocumentApi.GetDocumentFragmentByCSSSelector(name, csssel, "plain", null, folder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
var url = @"https://products.aspose.com/html/net"; | |
var csssel = "div.container"; | |
Stream stream = DocumentApi.GetDocumentFragmentByCSSSelectorByUrl(url, csssel, "plain"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Example 1 | |
var url = @"https://products.aspose.com/html/net"; | |
var xpath = ".//div[@class=\"container\"]"; | |
Stream stream = DocumentApi.GetDocumentFragmentByXPathByUrl(url, xpath, "plain"); | |
// Example 2 | |
var url = @"https://stallman.org/articles/words-to-greece.html"; | |
var xpath = ".//p"; | |
Stream stream = DocumentApi.GetDocumentFragmentByXPathByUrl(url, xpath, "plain"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
var url = @"http://www.sukidog.com/jpierre/strings/why.htm"; | |
Stream stream = DocumentApi.GetDocumentImagesByUrl(url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
// First upload source file to Cloud Storage as explained here | |
// https://docs.aspose.cloud/display/storagecloud/Upload+File+to+Aspose+Cloud+Storage | |
var name = "html_example1.html"; | |
string folder = null; | |
string storage = null; | |
Aspose.Html.Cloud.Sdk.Api.DocumentApi documentAPI = new Aspose.Html.Cloud.Sdk.Api.DocumentApi(appKey, appSID, basePath); | |
var result = documentAPI.GetDocument(name, storage, folder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
// First upload source file to Cloud Storage as explained here | |
// https://docs.aspose.cloud/display/storagecloud/Upload+File+to+Aspose+Cloud+Storage | |
string name = "testpage5.html.zip"; | |
string xpath = ".//p"; | |
string folder = null; | |
string storage = null; | |
Aspose.Html.Cloud.Sdk.Api.DocumentApi documentAPI = new Aspose.Html.Cloud.Sdk.Api.DocumentApi(appKey, appSID, basePath); | |
Stream stream = documentAPI.GetDocumentFragmentByXPath(name, xpath, "plain", storage, folder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
// First upload source file to Cloud Storage as explained here | |
// https://docs.aspose.cloud/display/storagecloud/Upload+File+to+Aspose+Cloud+Storage | |
string name = "testpage1.html"; | |
string folder = null; | |
Aspose.Html.Cloud.Sdk.Api.ConversionApi conversionApi = new Aspose.Html.Cloud.Sdk.Api.ConversionApi(appKey, appSID, basePath); | |
var response = conversionApi.GetConvertDocumentToImage(name, "jpeg", 800, 1200, null, null, null, null, null, null, folder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
string sourceUrl = @"https://stallman.org/articles/anonymous-payments-thru-phones.html"; | |
Aspose.Html.Cloud.Sdk.Api.ConversionApi conversionApi = new Aspose.Html.Cloud.Sdk.Api.ConversionApi(appKey, appSID, basePath); | |
var response = conversionApi.GetConvertDocumentToImageByUrl(sourceUrl, "jpeg", 800, 1200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
// First upload source file to Cloud Storage as explained here | |
// https://docs.aspose.cloud/display/storagecloud/Upload+File+to+Aspose+Cloud+Storage | |
string name = "testpage1.html"; | |
string folder = null; | |
Aspose.Html.Cloud.Sdk.Api.ConversionApi conversionApi = new Aspose.Html.Cloud.Sdk.Api.ConversionApi(appKey, appSID, basePath); | |
var response = conversionApi.GetConvertDocumentToPdf(name, 800, 1200, null, null, null, null, folder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
string sourceUrl = @"https://stallman.org/articles/anonymous-payments-thru-phones.html"; | |
Aspose.Html.Cloud.Sdk.Api.ConversionApi conversionApi = new Aspose.Html.Cloud.Sdk.Api.ConversionApi(appKey, appSID, basePath); | |
var response = conversionApi.GetConvertDocumentToPdfByUrl(sourceUrl, 800, 1200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
// First upload source file to Cloud Storage as explained here | |
// https://docs.aspose.cloud/display/storagecloud/Upload+File+to+Aspose+Cloud+Storage | |
string name = "testpage1.html"; | |
string folder = null; | |
Aspose.Html.Cloud.Sdk.Api.ConversionApi conversionApi = new Aspose.Html.Cloud.Sdk.Api.ConversionApi(appKey, appSID, basePath); | |
var response = conversionApi.GetConvertDocumentToXps(name, 800, 1200, null, null, null, null, folder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
string sourceUrl = @"https://stallman.org/articles/anonymous-payments-thru-phones.html"; | |
Aspose.Html.Cloud.Sdk.Api.ConversionApi conversionApi = new Aspose.Html.Cloud.Sdk.Api.ConversionApi(appKey, appSID, basePath); | |
var response = conversionApi.GetConvertDocumentToXpsByUrl(sourceUrl, 800, 1200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
// First upload source file to Cloud Storage as explained here | |
// https://docs.aspose.cloud/display/storagecloud/Upload+File+to+Aspose+Cloud+Storage | |
var name = "ocr_test_2.png"; | |
string folder = null; | |
Aspose.Html.Cloud.Sdk.Api.OcrApi ocrApi = new Aspose.Html.Cloud.Sdk.Api.OcrApi(appKey, appSID, basePath); | |
var result = ocrApi.GetRecognizeAndImportToHtml(name, "en", folder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
// First upload source file to Cloud Storage as explained here | |
// https://docs.aspose.cloud/display/storagecloud/Upload+File+to+Aspose+Cloud+Storage | |
var name = "ocr_test_1.png"; | |
string folder = null; | |
Aspose.Html.Cloud.Sdk.Api.OcrApi ocrApi = new Aspose.Html.Cloud.Sdk.Api.OcrApi(appKey, appSID, basePath); | |
var result = ocrApi.GetRecognizeAndTranslateToHtml(name, "en", "de", folder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
using System; | |
using System.IO; | |
using Aspose.Storage.Cloud.Sdk.Api; | |
using Aspose.Html.Cloud.Sdk.Api; | |
using Aspose.Html.Cloud.Sdk.Api.Interfaces; | |
namespace Aspose.HTML.Cloud.Examples.SDK.HtmlTemplateMerge | |
{ | |
public class MergeHtmlTemplateWithData : ISdkRunner | |
{ | |
public void Run() | |
{ | |
var templateName = "test_template_3_2.html"; | |
var dataFileName = "templ_merge_data_3.xml"; | |
var folder = "/14/HTML"; | |
string filePath = Path.Combine(CommonSettings.DataFolder, templateName); | |
// template should be uploaded to storage before | |
if (File.Exists(filePath)) | |
{ | |
SdkBaseRunner.UploadToStorage(templateName, CommonSettings.DataFolder); | |
} | |
else | |
throw new Exception(string.Format("Error: file {0} not found.", filePath)); | |
filePath = Path.Combine(CommonSettings.DataFolder, dataFileName); | |
// data file should be uploaded to storage before | |
if (File.Exists(filePath)) | |
{ | |
SdkBaseRunner.UploadToStorage(dataFileName, CommonSettings.DataFolder); | |
} | |
else | |
throw new Exception(string.Format("Error: file {0} not found.", filePath)); | |
ITemplateMergeApi mergeApi = new TemplateMergeApi(CommonSettings.AppKey, CommonSettings.AppSID, CommonSettings.BasePath); | |
// call SDK method that gets an HTML template and a data file from the storage | |
// and returns generated HTML document as stream. | |
string dataPath = $"{folder}/{dataFileName}"; | |
Stream stream = mergeApi.GetMergeHtmlTemplate(templateName, dataPath, folder); | |
if (stream != null && typeof(FileStream) == stream.GetType()) | |
{ | |
string outFile = $"{Path.GetFileNameWithoutExtension(templateName)}_merged.{Path.GetExtension(templateName)}"; | |
string outPath = Path.Combine(CommonSettings.OutDirectory, outFile); | |
using (FileStream fstr = new FileStream(outPath, FileMode.Create, FileAccess.Write)) | |
{ | |
stream.Position = 0; | |
stream.CopyTo(fstr); | |
fstr.Flush(); | |
Console.WriteLine(string.Format("\nResult file downloaded to: {0}", outPath)); | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
// First upload source file to Cloud Storage as explained here | |
// https://docs.aspose.cloud/display/storagecloud/Upload+File+to+Aspose+Cloud+Storage | |
string name = "testpage1.html"; | |
string folder = null; | |
Aspose.Html.Cloud.Sdk.Api.TranslationApi translationApi = new Aspose.Html.Cloud.Sdk.Api.TranslationApi(appKey, appSID, basePath); | |
Stream stream = translationApi.GetTranslateDocument(name, "en", "fr", folder, null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet | |
// Get App Key and App SID from https://dashboard.aspose.cloud/ | |
string appSID = "xxxxxxxx"; | |
string appKey = "xxxxxxxx"; | |
string basePath = "https://api.aspose.cloud/v1.1"; | |
string sourceUrl = @"https://www.le.ac.uk/oerresources/bdra/html/page_02.htm"; | |
Aspose.Html.Cloud.Sdk.Api.TranslationApi translationApi = new Aspose.Html.Cloud.Sdk.Api.TranslationApi(appKey, appSID, basePath); | |
Stream stream = translationApi.GetTranslateDocumentByUrl(sourceUrl, "en", "fr"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment