Skip to content

Instantly share code, notes, and snippets.

@aspose-html
Last active December 26, 2017 09:37
Show Gist options
  • Save aspose-html/5a473993ad059f174d4ef2b7bca8fd28 to your computer and use it in GitHub Desktop.
Save aspose-html/5a473993ad059f174d4ef2b7bca8fd28 to your computer and use it in GitHub Desktop.
This Gist contains Java code snippets for examples of Aspose.Html for Cloud.
Aspose.Html-for-Cloud
const string appSID = "XXXXXXXXXXXXXXXX"; // apply user's appSID
const string appKey = "XXXXXXXXXXXXXXXX"; // apply user's key
const string SERVICE_API_BASE_URL = "https://api.aspose.cloud/v1.1/html";
const string htmlDocName = "testpage1.html";
const string storageFolderName = "MyFolder"; // folder name in the cloud storage
const string localDocDirectory = @"d:\work\testdata"; // specify correct local path
// XPath examples
const string xPath_1 = "//img[@src]"; // IMG tags with src attribute
const string xPath_2 = "//*[@class=\"darkbox\"]"; // all elements with specified class
const string xPath_3 = ".//p[@class=\"greenbox\"]/text()"; // text content of all P tags with specified class
const string xPath_A = ".//@*"; // all attributes
public static void Main(string[] args)
{
UploadDocument(localDocDirectory, htmlDocName, storageFolderName);
ApiRun(htmlDocName, storageFolderName, xPath_1, "json");
}
public static void UploadDocument(string localPath, string fileName, string folder)
{
var url = $"{SERVICE_API_BASE_URL}/storage/file/{folder}/{fileName}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
using (FileStream docstream = new FileStream(localPath, FileMode.Open, FileAccess.Read))
{
StreamContent streamContent = new StreamContent(docstream);
streamContent.Headers.ContentType = new MediaTypeHeaderValue("text/html");
var client = new HttpClient();
// check if the document already exists is skipped for shortness
var response = client.PutAsync(signedUrl, streamContent);
}
}
public static ApiRun(string name, string folder, string xpath, string outFormat)
{
var url = $"{SERVICE_API_BASE_URL}/{name}/fragments/{outFormat}?xpath={xpath}&folder={folder}&appSid={appSID}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
var response = client.GetAsync(url).Result; // REST API call GET
if (response.HttpStatus == HttpStatusCode.OK)
{
var contentType = response.Content.Headers.ContentType;
Stream content = response.Content.ReadAsStreamAsync().Result;
// check the type of response content
if (outFormat.Equals("plain") && contentType.Equals(new MediaTypeHeaderValue("text/plain")))
{
// plain text, each fragment starts from new line
}
else if (outFormat.Equals("json") && contentType.Equals(new MediaTypeHeaderValue("application/json")))
{
// JSON array of fragments
}
else
{
// all other cases are invalid
}
}
}
private static string CalcUrlSignature(string url, string appKey)
{
// calculate URL signature here - skipped for shorteness
}
const string appSID = "XXXXXXXXXXXXXXXX"; // apply user's appSID
const string appKey = "XXXXXXXXXXXXXXXX"; // apply user's key
const string SERVICE_API_BASE_URL = "https://api.aspose.cloud/v1.1/html";
const string htmlDocName = "testpage1.html";
const string storageFolderName = "MyFolder"; // folder name in the cloud storage
const string localDocDirectory = @"d:\work\testdata"; // specify correct local path
public static void Main(string[] args)
{
UploadDocument(localDocDirectory, htmlDocName, storageFolderName); UploadDocument(localDocDirectory, htmlDocName, storageFolderName);
ApiRun(htmlDocName, storageFolderName);
}
public static void UploadDocument(string localPath, string fileName, string folder)
{
var url = $"{SERVICE_API_BASE_URL}/storage/file/{folder}/{fileName}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
using (FileStream docstream = new FileStream(localPath, FileMode.Open, FileAccess.Read))
{
StreamContent streamContent = new StreamContent(docstream);
streamContent.Headers.ContentType = new MediaTypeHeaderValue("text/html");
var client = new HttpClient();
// check if the document already exists is skipped for shortness
var response = client.PutAsync(signedUrl, streamContent);
}
}
public static ApiRun(string name, string folder)
{
var url = $"{SERVICE_API_BASE_URL}/{name}/images/all?folder={folder}&appSid={appSID}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
var response = client.GetAsync(url).Result; // REST API call - GET
if (response.HttpStatus == HttpStatusCode.OK)
{
var contentType = response.Content.Headers.ContentType;
Stream content = response.Content.ReadAsStreamAsync().Result;
// check the type of response content
if (contentType.Equals(new MediaTypeHeaderValue("application/zip")))
{
// unpack the ZIP stream to get images
}
else
{
// all other cases are invalid
}
}
}
private static string CalcUrlSignature(string url, string appKey)
{
// calculate URL signature here - skipped for shorteness
}
const string appSID = "XXXXXXXXXXXXXXXX"; // apply user's appSID
const string appKey = "XXXXXXXXXXXXXXXX"; // apply user's key
const string SERVICE_API_BASE_URL = "http://api.aspose.cloud/v1.1/html";
const string srcUrl = @"https://www.le.ac.uk/oerresources/bdra/html/page_01.htm";
const string storageFolderName = "MyFolder"; // folder name in the cloud storage
const string outFile = "page_01.jpeg";
public static void Main(string[] args)
{
ApiRun(srcUrl, "jpeg", storageFolderName, outFile);
}
public static ApiRun(string srcUrl, string format, string outFolder, string outFile)
{
var outPath = Path.Combine(outFolder, outFile);
var url = $"{SERVICE_API_BASE_URL}/convert/image/{format}?sourceUrl={srcUrl}&outPath={outPath}&appSid={appSID}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
var client = new HttpClient();
var response = client.PutAsync(url, null).Result; // REST API call - PUT
if (response.HttpStatus == HttpStatusCode.OK)
{
var contentType = response.Content.Headers.ContentType;
// check here if output file is present in the cloud storage - skipped for shortness
}
}
private static string CalcUrlSignature(string url, string appKey)
{
// calculate URL signature here - skipped for shortness
}
const string appSID = "XXXXXXXXXXXXXXXX"; // apply user's appSID
const string appKey = "XXXXXXXXXXXXXXXX"; // apply user's key
const string SERVICE_API_BASE_URL = "http://api.aspose.cloud/v1.1/html";
const string htmlDocName = "testpage1.html";
const string localDocDirectory = @"d:\work\testdata"; // specify correct local path
const string outDataPath = @"d\work\outdata\testpage1.jpg";
public static void Main(string[] args)
{
ApiRun(Path.Combine(localDocDirectory, htmlDocName), "jpeg", outDataPath);
}
public static ApiRun(string srcPath, string format, string outPath)
{
var url = $"{SERVICE_API_BASE_URL}/convert/image/{format}?appSid={appSID}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
// source document is in the local file system, it will be passed as the HTTP request body
Stream instream = new MemoryStream();
using (FileStream fstr = new FileStream(srcPath, FileMode.Open, FileAccess.Read))
{
fstr.CopyTo(instream);
instream.Flush();
}
// load source document into the request body
StreamContent content = new StreamContent(instream);
var client = new HttpClient();
var response = client.PutAsync(url, content).Result; // REST API call - PUT
if (response.HttpStatus == HttpStatusCode.OK)
{
var contentType = response.Content.Headers.ContentType;
Stream content = response.Content.ReadAsStreamAsync().Result;
// check the type of response content
if (contentType.Equals(new MediaTypeHeaderValue("image/jpeg"))
|| contentType.Equals(new MediaTypeHeaderValue("image/png"))
|| contentType.Equals(new MediaTypeHeaderValue("image/bmp"))
|| contentType.Equals(new MediaTypeHeaderValue("image/tiff")))
{
// if response type is an image format, process stream as an image
using (FileStream fstr = new FileStream(outPath, FileMode.CreateNew, FileAccess.Write))
{
content.CopyTo(fstr);
fstr.Flush();
}
}
else if (contentType.Equals(new MediaTypeHeaderValue("application/zip")))
{
// result document has been archived, unzip it first
}
}
}
private static string CalcUrlSignature(string url, string appKey)
{
// calculate URL signature here - skipped for shorteness
}
const string appSID = "XXXXXXXXXXXXXXXX"; // apply user's appSID
const string appKey = "XXXXXXXXXXXXXXXX"; // apply user's key
const string SERVICE_API_BASE_URL = "http://api.aspose.cloud/v1.1/html";
const string outDataPath = @"d\work\outdata\page_01.jpg";
const string srcUrl = @"https://www.le.ac.uk/oerresources/bdra/html/page_01.htm";
public static void Main(string[] args)
{
ApiRun(srcUrl, "jpeg", outDataPath);
}
public static ApiRun(string srcUrl, string format, string outPath)
{
var url = $"{SERVICE_API_BASE_URL}/convert/image/{format}?sourceUrl={srcUrl}&appSid={appSID}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
var client = new HttpClient();
var response = client.PutAsync(url, null).Result; // REST API call - PUT
if (response.HttpStatus == HttpStatusCode.OK)
{
var contentType = response.Content.Headers.ContentType;
Stream content = response.Content.ReadAsStreamAsync().Result;
// check the type of response content
if (contentType.Equals(new MediaTypeHeaderValue("image/jpeg"))
|| contentType.Equals(new MediaTypeHeaderValue("image/png"))
|| contentType.Equals(new MediaTypeHeaderValue("image/bmp"))
|| contentType.Equals(new MediaTypeHeaderValue("image/tiff")))
{
// if response type is one of image formats, process stream as an image
using (FileStream fstr = new FileStream(outPath, FileMode.CreateNew, FileAccess.Write))
{
content.CopyTo(fstr);
fstr.Flush();
}
}
else if (contentType.Equals(new MediaTypeHeaderValue("application/zip")))
{
// result document has been archived, unzip it first
}
}
}
private static string CalcUrlSignature(string url, string appKey)
{
// calculate URL signature here - skipped for shorteness
}
const string appSID = "XXXXXXXXXXXXXXXX"; // apply user's appSID
const string appKey = "XXXXXXXXXXXXXXXX"; // apply user's key
const string SERVICE_API_BASE_URL = "http://api.aspose.cloud/v1.1/html";
const string srcUrl = @"https://www.le.ac.uk/oerresources/bdra/html/page_01.htm";
const string storageFolderName = "MyFolder"; // folder name in the cloud storage
const string outFile = "page_01.pdf";
public static void Main(string[] args)
{
ApiRun(srcUrl, "pdf", storageFolderName, outFile);
}
public static ApiRun(string srcUrl, string format, string outFolder, string outFile)
{
var outPath = Path.Combine(outFolder, outFile);
var url = $"{SERVICE_API_BASE_URL}/convert/{format}?sourceUrl={srcUrl}&outPath={outPath}&appSid={appSID}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
var client = new HttpClient();
var response = client.PutAsync(url, null).Result; // REST API call - PUT
if (response.HttpStatus == HttpStatusCode.OK)
{
var contentType = response.Content.Headers.ContentType;
// check here if output file is present in the cloud storage - skipped for shortness
}
}
private static string CalcUrlSignature(string url, string appKey)
{
// calculate URL signature here - skipped for shortness
}
const string appSID = "XXXXXXXXXXXXXXXX"; // apply user's appSID
const string appKey = "XXXXXXXXXXXXXXXX"; // apply user's key
const string SERVICE_API_BASE_URL = "http://api.aspose.cloud/v1.1/html";
const string htmlDocName = "testpage1.html";
//const string storageFolderName = "MyFolder"; // folder name in the cloud storage
const string localDocDirectory = @"d:\work\testdata"; // specify correct local path
const string outDataPath = @"d\work\outdata\testpage1.pdf";
public static void Main(string[] args)
{
ApiRun(Path.Combine(localDocDirectory, htmlDocName), "pdf", outDataPath);
}
public static ApiRun(string srcPath, string format, string outPath)
{
var url = $"{SERVICE_API_BASE_URL}/convert/{format}?appSid={appSID}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
// source document is in the local file system, it will be passed as the HTTP request body
Stream instream = new MemoryStream();
using (FileStream fstr = new FileStream(srcPath, FileMode.Open, FileAccess.Read))
{
fstr.CopyTo(instream);
instream.Flush();
}
// load source document into the request body
StreamContent content = new StreamContent(instream);
var client = new HttpClient();
var response = client.PutAsync(url, content).Result; // REST API call - PUT
if (response.HttpStatus == HttpStatusCode.OK)
{
var contentType = response.Content.Headers.ContentType;
Stream content = response.Content.ReadAsStreamAsync().Result;
// check the type of response content
if (contentType.Equals(new MediaTypeHeaderValue("application/pdf"))
|| contentType.Equals(new MediaTypeHeaderValue("application/vnd.ms-xpsdocument")))
{
// if response type is PDF or XPS, process stream as PDF/XPS document
using (FileStream fstr = new FileStream(outPath, FileMode.CreateNew, FileAccess.Write))
{
content.CopyTo(fstr);
fstr.Flush();
}
}
else if (contentType.Equals(new MediaTypeHeaderValue("application/zip")))
{
// result document has been archived, unzip it first
}
}
}
private static string CalcUrlSignature(string url, string appKey)
{
// calculate URL signature here - skipped for shorteness
}
const string appSID = "XXXXXXXXXXXXXXXX"; // apply user's appSID
const string appKey = "XXXXXXXXXXXXXXXX"; // apply user's key
const string SERVICE_API_BASE_URL = "http://api.aspose.cloud/v1.1/html";
const string outDataPath = @"d\work\outdata\page_01.pdf";
const string srcUrl = @"https://www.le.ac.uk/oerresources/bdra/html/page_01.htm";
public static void Main(string[] args)
{
ApiRun(srcUrl, "pdf", outDataPath);
}
public static ApiRun(string srcUrl, string format, string outPath)
{
var url = $"{SERVICE_API_BASE_URL}/convert/{format}?sourceUrl={srcUrl}&appSid={appSID}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
var client = new HttpClient();
var response = client.PutAsync(url, null).Result; // REST API call - PUT
if (response.HttpStatus == HttpStatusCode.OK)
{
var contentType = response.Content.Headers.ContentType;
Stream content = response.Content.ReadAsStreamAsync().Result;
// check the type of response content
if (contentType.Equals(new MediaTypeHeaderValue("application/pdf"))
|| contentType.Equals(new MediaTypeHeaderValue("application/vnd.ms-xpsdocument")))
{
// if response type is PDF or XPS, process stream as PDF/XPS document
using (FileStream fstr = new FileStream(outPath, FileMode.CreateNew, FileAccess.Write))
{
content.CopyTo(fstr);
fstr.Flush();
}
}
else if (contentType.Equals(new MediaTypeHeaderValue("application/zip")))
{
// result document has been archived, unzip it first
}
}
}
private static string CalcUrlSignature(string url, string appKey)
{
// calculate URL signature here - skipped for shorteness
}
const string appSID = "XXXXXXXXXXXXXXXX"; // apply user's appSID
const string appKey = "XXXXXXXXXXXXXXXX"; // apply user's key
const string SERVICE_API_BASE_URL = "http://api.aspose.cloud/v1.1/html";
const string srcUrl = @"https://www.le.ac.uk/oerresources/bdra/html/page_01.htm";
const string storageFolderName = "MyFolder"; // folder name in the cloud storage
const string outFile = "page_01.xps";
public static void Main(string[] args)
{
ApiRun(srcUrl, "xps", storageFolderName, outFile);
}
public static ApiRun(string srcUrl, string format, string outFolder, string outFile)
{
var outPath = Path.Combine(outFolder, outFile);
var url = $"{SERVICE_API_BASE_URL}/convert/{format}?sourceUrl={srcUrl}&outPath={outPath}&appSid={appSID}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
var client = new HttpClient();
var response = client.PutAsync(url, null).Result; // REST API call - PUT
if (response.HttpStatus == HttpStatusCode.OK)
{
var contentType = response.Content.Headers.ContentType;
// check here if output file is present in the cloud storage - skipped for shortness
}
}
private static string CalcUrlSignature(string url, string appKey)
{
// calculate URL signature here - skipped for shortness
}
const string appSID = "XXXXXXXXXXXXXXXX"; // apply user's appSID
const string appKey = "XXXXXXXXXXXXXXXX"; // apply user's key
const string SERVICE_API_BASE_URL = "http://api.aspose.cloud/v1.1/html";
const string htmlDocName = "testpage1.html";
//const string storageFolderName = "MyFolder"; // folder name in the cloud storage
const string localDocDirectory = @"d:\work\testdata"; // specify correct local path
const string outDataPath = @"d\work\outdata\testpage1.xps";
public static void Main(string[] args)
{
ApiRun(Path.Combine(localDocDirectory, htmlDocName), "xps", outDataPath);
}
public static ApiRun(string srcPath, string format, string outPath)
{
var url = $"{SERVICE_API_BASE_URL}/convert/{format}?appSid={appSID}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
// source document is in the local file system, it will be passed as the HTTP request body
Stream instream = new MemoryStream();
using (FileStream fstr = new FileStream(srcPath, FileMode.Open, FileAccess.Read))
{
fstr.CopyTo(instream);
instream.Flush();
}
// load source document into the request body
StreamContent content = new StreamContent(instream);
var client = new HttpClient();
var response = client.PutAsync(url, content).Result; // REST API call - PUT
if (response.HttpStatus == HttpStatusCode.OK)
{
var contentType = response.Content.Headers.ContentType;
Stream content = response.Content.ReadAsStreamAsync().Result;
// check the type of response content
if (contentType.Equals(new MediaTypeHeaderValue("application/pdf"))
|| contentType.Equals(new MediaTypeHeaderValue("application/vnd.ms-xpsdocument")))
{
// if response type is PDF or XPS, process stream as PDF/XPS document
using (FileStream fstr = new FileStream(outPath, FileMode.CreateNew, FileAccess.Write))
{
content.CopyTo(fstr);
fstr.Flush();
}
}
else if (contentType.Equals(new MediaTypeHeaderValue("application/zip")))
{
// result document has been archived, unzip it first
}
}
}
private static string CalcUrlSignature(string url, string appKey)
{
// calculate URL signature here - skipped for shorteness
}
const string appSID = "XXXXXXXXXXXXXXXX"; // apply user's appSID
const string appKey = "XXXXXXXXXXXXXXXX"; // apply user's key
const string SERVICE_API_BASE_URL = "http://api.aspose.cloud/v1.1/html";
const string outDataPath = @"d\work\outdata\page_01.xps";
const string srcUrl = @"https://www.le.ac.uk/oerresources/bdra/html/page_01.htm";
public static void Main(string[] args)
{
ApiRun(srcUrl, "xps", outDataPath);
}
public static ApiRun(string srcUrl, string format, string outPath)
{
var url = $"{SERVICE_API_BASE_URL}/convert/{format}?sourceUrl={srcUrl}&appSid={appSID}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
var client = new HttpClient();
var response = client.PutAsync(url, null).Result; // REST API call - PUT
if (response.HttpStatus == HttpStatusCode.OK)
{
var contentType = response.Content.Headers.ContentType;
Stream content = response.Content.ReadAsStreamAsync().Result;
// check the type of response content
if (contentType.Equals(new MediaTypeHeaderValue("application/pdf"))
|| contentType.Equals(new MediaTypeHeaderValue("application/vnd.ms-xpsdocument")))
{
// if response type is PDF or XPS, process stream as PDF/XPS document
using (FileStream fstr = new FileStream(outPath, FileMode.CreateNew, FileAccess.Write))
{
content.CopyTo(fstr);
fstr.Flush();
}
}
else if (contentType.Equals(new MediaTypeHeaderValue("application/zip")))
{
// result document has been archived, unzip it first
}
}
}
private static string CalcUrlSignature(string url, string appKey)
{
// calculate URL signature here - skipped for shorteness
}
const string appSID = "XXXXXXXXXXXXXXXX"; // apply user's appSID
const string appKey = "XXXXXXXXXXXXXXXX"; // apply user's key
const string SERVICE_API_BASE_URL = "https://api.aspose.cloud/v1.1/html";
const string htmlDocName = "testpage1.html";
const string storageFolderName = "MyFolder";
public static void Main(string[] args)
{
UploadDocument(htmlDocName, storageFolderName);
ApiRun(htmlDocName, storageFolderName, "en", "de");
ApiRun(htmlDocName, storageFolderName, "en", "fr");
ApiRun(htmlDocName, storageFolderName, "en", "ru");
}
private static void UploadDocument(string fileName, string folder)
{
var url = $"{SERVICE_API_BASE_URL}/storage/file/{folder}/{fileName}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
Stream docstream = new MemoryStream();
using (StreamWriter sw = new StreamWriter(docstream))
{
sw.Write("<p>" + "This is the first text paragraph. There is some more text." + "</p>" +
"<p>" +
"<div>There is a translation example you could try. It translates text from English to German, French and Russian simultaneously.</div>" +
"<div>Here's a working example you can run in a console application. What do you think about it?</div>" +
"</p>" +
"<div>Who is the president of the United States?</div>" +
"<p>This is the second paragraph.</p>" +
"<p>" + "Here is the last paragraph. Much more text could be here." + "</p>");
}
StreamContent streamContent = new StreamContent(docstream);
streamContent.Headers.ContentType = new MediaTypeHeaderValue("text/html");
var client = new HttpClient();
// check if the document already exists is skipped for shortness
var response = client.PutAsync(signedUrl, streamContent);
}
private static ApiRun(string name, string folder, string fromLang, string toLang)
{
var url = $"{SERVICE_API_BASE_URL}/{name}/translate/{fromLang}/{toLang}?folder={folder}&appSid={appSID}";
// calculate the signature based on the URL with appSID and appKey
var sign = CalcUrlSignature(url, appKey);
var signedUrl = $"{url}&signature={sign}";
var response = client.GetAsync(url).Result; // REST API call - GET
if (response.HttpStatus == HttpStatusCode.OK)
{
var contentType = response.Content.Headers.ContentType;
Stream content = response.Content.ReadAsStreamAsync().Result;
// check the type of response content
if (contentType.Equals(new MediaTypeHeaderValue("text/html")))
{
// if response type is HTML, process stream as HTML layout
using (StreamReader rdr = new StreamReader(content))
{
Console.Write(rdr.ReadToEnd());
}
}
else if (contentType.Equals(new MediaTypeHeaderValue("application/zip")))
{
// if response type is ZIP, unpack the archive stream
// to get HTML page with the resource files
}
}
}
private static string CalcUrlSignature(string url, string appKey)
{
// calculate URL signature here - skipped for shorteness
}
from __future__ import print_function
import time
import asposehtmlcloud
from asposehtmlcloud.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = asposehtmlcloud.HtmlDocumentTranslationApi()
source_url = 'source_url_example' # str | Source document URL.
src_lang = 'src_lang_example' # str | Source language.
res_lang = 'res_lang_example' # str | Result language.
try:
# Translate the HTML document specified by its URL.
api_response = api_instance.html_document_translation_get_translate_document_by_url(source_url, src_lang, res_lang)
pprint(api_response)
except ApiException as e:
print("Exception when calling HtmlDocumentTranslationApi->html_document_translation_get_translate_document_by_url: %s\n" % e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment