Skip to content

Instantly share code, notes, and snippets.

@aspose-cloud
Last active December 2, 2021 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-cloud/4edb9665c129607ce52c6fbdfa0ee2cd to your computer and use it in GitHub Desktop.
Save aspose-cloud/4edb9665c129607ce52c6fbdfa0ee2cd to your computer and use it in GitHub Desktop.
This Gist repository contains code snippet related to Aspose.HTML Cloud SDK for .NET
Aspose.Tasks-Cloud-SDK-NET
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet
string name = "testpage2.html";
string outPath = Path.Combine(testoutStorageFolder, $"{name}_converted_at_{DateTime.Now.ToString("yyMMdd_hhmmss")}.jpg");
string srcPath = Path.Combine(LocalTestDataPath, name);
using (Stream stream = new FileStream(srcPath, FileMode.Open, FileAccess.Read))
{
var response = this.HtmlApi.PostConvertDocumentToImage(stream, "jpeg", outPath);
Assert.IsNotNull(response);
Assert.AreEqual(200, response.Code);
}
Assert.IsTrue(StorageApi.FileOrFolderExists(outPath));
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet
string name = "testpage1.html";
string outPath = Path.Combine(testoutStorageFolder, $"{name}_converted_at_{DateTime.Now.ToString("yyMMdd_hhmmss")}.md");
string srcPath = Path.Combine(LocalTestDataPath, name);
using (Stream stream = new FileStream(srcPath, FileMode.Open, FileAccess.Read))
{
var response = this.HtmlApi.PostConvertDocumentToMarkdown(stream, outPath);
Assert.IsNotNull(response);
Assert.AreEqual(200, response.Code);
}
Assert.IsTrue(StorageApi.FileOrFolderExists(outPath));
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet
string name = "testpage1.html";
string outPath = Path.Combine(testoutStorageFolder, $"{name}_converted_at_{DateTime.Now.ToString("yyMMdd_hhmmss")}.pdf");
string srcPath = Path.Combine(LocalTestDataPath, name);
using (Stream stream = new FileStream(srcPath, FileMode.Open, FileAccess.Read))
{
var response = this.HtmlApi.PostConvertDocumentToPdf(stream, outPath);
Assert.IsNotNull(response);
Assert.AreEqual(200, response.Code);
}
Assert.IsTrue(StorageApi.FileOrFolderExists(outPath));
// For complete examples and data files, please go to https://github.com/aspose-html-cloud/aspose-html-cloud-dotnet
string name = "testpage1.html";
string outPath = Path.Combine(testoutStorageFolder, $"{name}_converted_at_{DateTime.Now.ToString("yyMMdd_hhmmss")}.xps");
string srcPath = Path.Combine(LocalTestDataPath, name);
using (Stream stream = new FileStream(srcPath, FileMode.Open, FileAccess.Read))
{
var response = this.HtmlApi.PostConvertDocumentToXps(stream, outPath);
Assert.IsNotNull(response);
Assert.AreEqual(200, response.Code);
}
Assert.IsTrue(StorageApi.FileOrFolderExists(outPath));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment