Skip to content

Instantly share code, notes, and snippets.

@aspose-cloud aspose-cloud/Aspose-Cloud
Last active Nov 11, 2019

Embed
What would you like to do?
This Gist contains examples of aspose.cloud APIs for Blog Posts
Aspose-Cloud
// Get App Key and App SID from https://dashboard.aspose.cloud/
// Instantiate Aspose BarCode Cloud API SDK
var barCodeApi = new BarCodeApi(AppKey, AppSid);
// Set Filename of image
String datafolder = "C:/Temp/";
// Set Filename of image
String name = "sample-barcode";
// Set Text to encode inside barcode
String text = "Aspose.BarCode";
// Set Barcode Symbology
String type = "datamatrix";
// Set Barcode Image Format
String format = "PNG";
// Sets if checksum will be added to barcode image.
String enableChecksum = null;
// Set optional params (if any)
float? resolutionX = null;
float? resolutionY = null;
float? dimensionX = null;
float? dimensionY = null;
try
{
// Invoke Aspose.BarCode Cloud SDK API to create barcode and returns result as stream in the response
using (Stream response = barCodeApi.BarCodeGetBarCodeGenerate(new BarCodeGetBarCodeGenerateRequest(text, type, format, resolutionX, resolutionY, dimensionX, dimensionY, enableChecksum)))
// Download generated barcode from api response
using (FileStream stream = File.Create(datafolder + name + "." + format))
{
response.CopyTo(stream);
}
Console.WriteLine("Generate Barcode to Local File, Done!");
}
catch (Exception ex)
{
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// Get App Key and App SID from https://dashboard.aspose.cloud/
// Instantiate Aspose BarCode Cloud API SDK
var barCodeApi = new BarCodeApi(AppKey, AppSid);
// Set Filename of image
String datafolder = "C:/Temp/";
// Set input file name
String name = "sample-barcode.png";
// The barcode type. If this parameter is empty, autodetection of all supported types is used.
String type = "";
// Set mode for checksum validation during recognition
String checksumValidation = "";
// Set if FNC symbol stripping should be performed
bool stripFnc = false;
// Set recognition of rotated barcode
int rotationAngle = 0;
// Set the image file url
String url = null;
Stream file = System.IO.File.OpenRead(datafolder + name);
try
{
// Invoke Aspose.BarCode Cloud SDK API to read barcode from local file
var apiResponse = barCodeApi.BarCodePostBarCodeRecognizeFromUrlorContent( new BarCodePostBarCodeRecognizeFromUrlorContentRequest(type, checksumValidation, stripFnc, rotationAngle, url, file));
if (apiResponse != null)
{
foreach (var barcode in apiResponse.BarCodes)
{
Console.WriteLine("Codetext: " + barcode.BarCodeValue + "\nType: " + barcode.BarCodeType);
}
Console.WriteLine("Read Barcode from Local File, Done!");
}
}
catch (Exception ex)
{
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
}
// First get Access Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl "https://api.aspose.cloud/oauth2/token"
-X POST
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]"
-H "Content-Type: application/x-www-form-urlencoded"
-H "Accept: application/json"
// cURL example to upload file to default Aspose Cloud Storage using Aspose.Storage Cloud
curl "https://api.aspose.cloud/v1.1/storage/file?path=test.xlsx"
-X PUT
-T C:/Temp/test.xlsx
-H "Content-Type: multipart/form-data"
-H "Accept: application/json"
-H "Authorization: Bearer [ACCESS_TOKEN]"
// cURL example to convert Excel Document to PDF
curl -v "http://api.aspose.cloud/v1.1/cells/test.xlsx/saveAs?newfilename=test.pdf"
-X POST
-d '{"SaveFormat":"pdf"}'
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer [Access_Token]"
// cURL example to download file from default Aspose Cloud Storage using Aspose.Storage Cloud
curl "https://api.aspose.cloud/v1.1/storage/file?path=test.pdf"
-X GET
-H "Content-Type: application/json"
-H "Accept: multipart/form-data"
-H "Authorization: Bearer [Access_Token]"
--output C:/Temp/test.PDF
// First get JSON Web Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl "https://api.aspose.cloud/connect/token"
-X POST
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]"
-H "Content-Type: application/x-www-form-urlencoded"
-H "Accept: application/json"
// cURL example to upload file to Aspose Cloud Storage
curl -X PUT "https://api.aspose.cloud/v3.0/cells/storage/file/test.xlsx"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: multipart/form-data"
-F "File=@C:/Temp/test.xlsx"
// cURL example to convert XLSX to PDF
curl -X POST "https://api.aspose.cloud/v3.0/cells/test.xlsx/SaveAs?newfilename=test.pdf"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access_Token]"
-d '{"SaveFormat":"pdf"}'
// Download updated file from Aspose Cloud Storage
curl -X GET "https://api.aspose.cloud/v3.0/cells/storage/file/test.pdf"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access_Token]"
--output C:/Temp/test_output.pdf
// cURL example to convert Excel Document to Markdown
curl -v "https://api.aspose.cloud/v1.1/cells/Book1.xlsx/SaveAs?newfilename=Book1.md&isAutoFitRows=true&isAutoFitColumns=true" \
-X POST \
-d "{"SaveFormat":"markdown","OnePagePerSheet":true}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer [Access_Token]"
// cURL example to upload file to Aspose Cloud Storage
curl "https://api.aspose.cloud/v1.1/storage/file?path=Book1.xlsx"
-X PUT
-T C:/Temp/Book1.xlsx
-H "Content-Type: multipart/form-data"
-H "Accept: application/json"
-H "Authorization: Bearer [ACCESS_TOKEN]"
# Get your app_sid and app_key at https://dashboard.aspose.cloud (free registration is required).
app_sid = 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxx'
app_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
imaging_api = asposeimagingcloud.ImagingApi(app_key, app_sid)
try:
# upload local image to storage
upload_file_request = asposeimagingcloud.UploadFileRequest('test.otg', 'VariousObjectsMultiPage.otg')
result = imaging_api.upload_file(upload_file_request)
# inspect result.errors list if there were any
# inspect result.uploaded list for uploaded file names
# convert image from storage to BMP
save_as_request = asposeimagingcloud.SaveImageAsRequest('test.otg', 'bmp', None)
converted_image = imaging_api.save_image_as(save_as_request)
# process resulted image
# for example, save it to storage
upload_file_request = asposeimagingcloud.UploadFileRequest('resultImage.bmp', converted_image)
result = imaging_api.upload_file(upload_file_request)
# inspect result.errors list if there were any
# inspect result.uploaded list for uploaded file names
except Exception as e:
print(e)
// cURL example to convert OTG Image to BMP and save result to local drive
curl -X GET "https://api.aspose.cloud/v3.0/imaging/VariousObjectsMultiPage.otg/saveAs?format=bmp"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
--output C:/Temp/OTGtoBMP.bmp
// cURL example to resize an image and save result to local drive
curl -v "https://api.aspose.cloud/v3/imaging/WaterMark.bmp/resize?format=pdf&newWidth=400&newHeight=400" \
-X GET \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer [JWT_Token]" \
-o C:/Temp/WaterMark_out.pdf
// cURL example to upload file from local drive to Aspose default storage
curl -X PUT "https://api.aspose.cloud/v3.0/imaging/storage/file/ImageResult%2FWaterMark_out.pdf" \
-H "accept: application/json" \
-H "authorization: Bearer [JWT_Token]" \
-H "Content-Type: multipart/form-data" \
-T C:/Temp/WaterMark_out.pdf
// Add Bookmarks to PDF docuemnt
curl -X POST "https://api.aspose.cloud/v3.0/pdf/4pages.pdf/bookmarks/bookmark"
-H "Content-Type: application/json"
-H "Accept: application/json"
-H "Authorization: Bearer [JWT_Access_Token]"
-d "[{"Title": "Page 1 (XYZ)", "Italic": true, "Bold": false, "Color": {"A": 255, "R": 255, "G": 0, "B": 0 }, "Action": "GoTo", "Level": null, "Destination": null, "PageDisplay": "XYZ", "PageDisplay_Bottom": null, "PageDisplay_Left": 82, "PageDisplay_Right": null, "PageDisplay_Top": 784, "PageDisplay_Zoom": 2, "PageNumber": 1, "RemoteFile": null, "Bookmarks": null, "Links": null } ]"
// Get App Key and App SID from https://dashboard.aspose.cloud/
// Install Nuget Package Aspose.PDF-Cloud
PdfApi pdfApi = new PdfApi(AppKey, AppSid);
string name = "02_pages.pdf";
var textBoxes = new List<TextBoxField> {
new TextBoxField(PageIndex: 1, IsGroup: false)
{
Color = new Color(255, 255, 0, 0),
Multiline = true,
MaxLen = 100,
Rect = new Rectangle(100, 100, 500, 200),
Value = "Page 1\nValue",
PartialName = "testField",
},
new TextBoxField(PageIndex: 2, IsGroup: false)
{
Color = new Color(255, 255, 0, 0),
Multiline = true,
MaxLen = 100,
Rect = new Rectangle(100, 100, 500, 200),
Value = "Page 2\nValue",
PartialName = "testField1",
}
};
// Add TextBoxField
var response = pdfApi.PostTextBoxFields(name, textBoxes);
Console.WriteLine(response);
public void PostPageCertifyTest()
{
const string name = "4pages.pdf";
UploadFile(name, name);
const string signatureName = "33226.p12";
UploadFile(signatureName, signatureName);
const string pass = "sIikZSmz";
DocMDPAccessPermissionType permissionType = DocMDPAccessPermissionType.NoChanges;
Signature signature = new Signature(
Authority: "Sergey Smal",
Contact: "test@mail.ru",
Date: "08/01/2012 12:15:00.000 PM",
FormFieldName: "Signature1",
Location: "Ukraine",
Password: pass,
Rectangle: new Rectangle(
LLX: 100,
LLY: 100,
URX: 500,
URY: 200),
SignaturePath: Path.Combine(TempFolder, signatureName),
SignatureType: SignatureType.PKCS7,
Visible: true,
ShowProperties: false);
var response = PdfApi.PostPageCertify(name, pageNumber: 1, sign: signature,
docMdpAccessPermissionType: permissionType.ToString(), folder: TempFolder);
}
// Export FDF Data from PDF Form
curl -X GET "https://api.aspose.cloud/v3.0/pdf/PDF%20Form.pdf/export/fdf"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access_Token]"
--output C:/Temp/ExportFDF.fdf
// Export XFDF Data from PDF Form
curl -X GET "https://api.aspose.cloud/v3.0/pdf/PDF%20Form.pdf/export/xfdf"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access_Token]"
--output C:/Temp/ExportXFDF.xfdf
// Export XML Data from PDF Form
curl -X GET "https://api.aspose.cloud/v3.0/pdf/PDF%20Form.pdf/export/xml"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access_Token]"
--output C:/Temp/ExportXML.xml
// Get App Key and App SID from https://dashboard.aspose.cloud/
// Install Nuget Package Aspose.PDF-Cloud
PdfApi pdfApi = new PdfApi(AppKey, AppSid);
string name = "02_pages.pdf";
// Get TextBox fields list from PDF document
var response = pdfApi.GetDocumentTextBoxFields(name);
foreach ( TextBoxField textBoxField in response.Fields.List)
{
Console.WriteLine(textBoxField);
Console.WriteLine(".....");
}
// Get App Key and App SID from https://dashboard.aspose.cloud/
// Install Nuget Package Aspose.PDF-Cloud
PdfApi pdfApi = new PdfApi(AppKey, AppSid);
string name = "02_pages.pdf";
// Get TextBox field by name from PDF Document
var response = pdfApi.GetTextBoxField(name, fieldName: "testField");
Console.WriteLine(response);
// Get App Key and App SID from https://dashboard.aspose.cloud/
// Install Nuget Package Aspose.PDF-Cloud
PdfApi pdfApi = new PdfApi(AppKey, AppSid);
string name = "02_pages.pdf";
// Get TextBox fields from PDF page
var response = pdfApi.GetPageTextBoxFields(name, pageNumber: 1);
foreach ( TextBoxField textBoxField in response.Fields.List)
{
Console.WriteLine(textBoxField);
Console.WriteLine(".....");
}
// Import FDF Data into PDF Form
curl -X GET "https://api.aspose.cloud/v3.0/pdf/PDF%20Form.pdf/import/fdf?fdfFilePath=ExportFDF.fdf"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access_Token]"
--output C:/Temp/ImportFDF.pdf
// Import XFDF Data into PDF Form
curl -X GET "https://api.aspose.cloud/v3.0/pdf/PDF%20Form.pdf/import/xfdf?xfdfFilePath=ExportXFDF.xfdf"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access_Token]"
--output C:/Temp/ImportXFDF.pdf
// Import XML Data into PDF Form
curl -X GET "https://api.aspose.cloud/v3.0/pdf/PDF%20Form.pdf/import/xml?xmlFilePath=exportXML.xml"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access_Token]"
--output C:/Temp/ImportXML.pdf
import asposepdfcloud
from asposepdfcloud.apis.pdf_api import PdfApi
# Get App key and App SID from https://cloud.aspose.com
pdf_api_client = asposepdfcloud.api_client.ApiClient(
app_key='xxxxxxxxxxxxxxxxxxxxxxxxxxx',
app_sid='xxxxxx-xxxx-xxxx-xxxxxxxx')
pdf_api = PdfApi(pdf_api_client)
filename = 'README.md'
remote_name = 'READMESaveAs.md'
#upload Markdown file to storage
pdf_api.upload_file(remote_name,filename)
#Covert Markdown to PDF and return resultant file in response
response=pdf_api.get_markdown_in_storage_to_pdf(remote_name)
import os
import asposepdfcloud
from asposepdfcloud.apis.pdf_api import PdfApi
# Get App key and App SID from https://cloud.aspose.com
pdf_api_client = asposepdfcloud.api_client.ApiClient(
app_key='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
app_sid='xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx')
pdf_api = PdfApi(pdf_api_client)
filename = '4pages.pdf'
remote_name = '4pages.pdf'
output_file= '4pages.xml'
#upload PDF file to storage
pdf_api.upload_file(remote_name,filename)
#Covert PDF to XML and save in Aspose default storage
response=pdf_api.put_pdf_in_storage_to_xml(remote_name,output_file)
print(response)
// Upload file to Aspose Cloud Storage
curl -X PUT "https://api.aspose.cloud/v3.0/pdf/storage/file/4pages.pdf"
-H "accept: application/json"
-H "authorization: Bearer [JWT_Access_Token]"
-H "Content-Type: multipart/form-data"
-T C:/Temp/4pages.pdf
//Update Slide Animation
curl -X PUT "https://api.aspose.cloud/v3.0/slides/animation.pptx/slides/1/animation"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: application/json"
-d "{"mainSequence":[{"type": "Appear","presetClassType":"Entrance","shapeIndex":1,"triggerType":"OnClick"},{"type":"Appear","presetClassType":"Entrance","shapeIndex":2,"triggerType":"OnClick"}],"interactiveSequences":[{"effects":[{"type":"Fly","subtype":"Bottom","presetClassType":"Entrance","shapeIndex":5,"triggerType":"OnClick" }],"triggerShapeIndex": 1}]}"
// Download updated file from Aspose Cloud Storage
curl -X GET "https://api.aspose.cloud/v3.0/slides/storage/file/animation.pptx"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access_Token]"
-o C:/Temp/animation_out.pptx
// Convert Presentation to POT Template
ccurl -X POST "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/pot"
-H "accept: multipart/form-data"
-H "authorization: Bearer [JWT_Acess_Token]"
-H "Content-Type: application/json"
--output C:/Temp/MyPresentation.pot
// Convert Presentation to Responsive HTML
curl -X POST "https://api.aspose.cloud/v3.0/slides/MyPresentation.pptx/html"
-H "accept: multipart/form-data"
-H "authorization: Bearer [JWT_Acess_Token]"
-H "Content-Type: application/json"
-d "{ "SaveAsZip": true, "SubDirectoryName": null, "SvgResponsiveLayout": true}"
--output C:/Temp/MyPresentation.zip
//Get a JSON/XML representation of the presentation
curl -X GET "https://api.aspose.cloud/v3.0/slides/test.ppt?password=Password123"
-H "x-aspose-timeout: 1"
-H "accept: application/json"
-H "authorization: Bearer [access_token]"
// Upload file to Aspose Cloud Storage
curl -X PUT "https://api.aspose.cloud/v3.0/slides/storage/file/animation.pptx"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: multipart/form-data"
-T C:/Temp/animation.pptx
// Convert Project document to PDF
curl -X GET "https://api.aspose.cloud/v3.0/tasks/NewProductDev.mpp/format?format=6"
-H "accept: multipart/form-data"
-H "authorization: Bearer [JWT_Access_Token]"
--output C:/temp/NewProductDev.pdf
// Upload file to Aspose Cloud Storage
curl -X POST "https://api.aspose.cloud/v3.0/tasks/storage/file/NewProductDev.mpp"
-H "accept: application/json"
-H "authorization: Bearer [JWT_Access_Token]"
-H "Content-Type: multipart/form-data"
-F "File=@C:/Temp/NewProductDev.mpp"
// First get JSON Web Token
// Please get your App Key and App SID from https://dashboard.aspose.cloud/#/apps. Kindly place App Key in "client_secret" and App SID in "client_id" argument.
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
// cURL example to get a list of paragraphs that are contained in the document or in the section
curl -v "https://api.aspose.cloud/v4.0/words/MyDocument.docx/paragraphs" \
-X GET \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer [Acess_Token]"
// First get Access Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl "https://api.aspose.cloud/oauth2/token"
-X POST
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]"
-H "Content-Type: application/x-www-form-urlencoded"
-H "Accept: application/json"
// cURL example to upload file to Aspose Cloud Storage
curl "https://api.aspose.cloud/v1.1/storage/file?path=multilevellist.pdf"
-X PUT
-T C:/Temp/multilevellist.pdf
-H "Content-Type: multipart/form-data"
-H "Accept: application/json"
-H "Authorization: Bearer [ACCESS_TOKEN]"
// cURL example to convert PDF Document to Word
curl "https://api.aspose.cloud/v1.1/words/multilevellist.pdf/saveAs"
-X POST
-H "Content-Type: application/json"
-d '{"SaveFormat": "docx","FileName": "multilevellistapi.docx",}'
-H "Accept: application/json"
-H "Authorization: Bearer [ACCESS_TOKEN]"Aspose-Cloud
// First get JSON Web Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
// cURL example to upload file to Aspose Cloud Storage
curl "https://api.aspose.cloud/v4.0/words/storage/file/sample.pptx"
-X PUT
-H "accept: application/json"
-H "Content-Type: multipart/form-data"
-T C:/sample.pptx
-H "authorization: Bearer [ACCESS_TOKEN]"
// cURL example to convert PDF Document to Word
curl "https://api.aspose.cloud/v4.0/words/multilevellist.pdf/saveAs"
-X PUT
-H "Content-Type: application/json"
-d "{"SaveFormat": "docx","FileName": "multilevellistapi.docx",}"
-H "Accept: application/json"
-H "authorization: Bearer [ACCESS_TOKEN]"
//Replace the range contents
curl -X POST "https://api.aspose.cloud/v4.0/words/MyDocument.docx/range/id0.0/id0.1?destFileName=range_replace_test.docx"
-H "accept: application/json"
-H "authorization: Bearer [Acess_Token]"
-H "Content-Type: application/json"
-d "{ \"Text\": \"Aspose File Format Expert\"}"
// Finding Duplicte Images
double? similarityThreshold = 80; // The similarity threshold
string folder = null; // Path to input files
string storage = null; // We are using default Cloud Storage
ImageDuplicatesSet imageDuplicatesSet = imagingApi.FindImageDuplicates(new FindImageDuplicatesRequest(searchContextId, similarityThreshold, folder, storage));
Console.WriteLine("Duplicates Set Count: " + imageDuplicatesSet.Duplicates.Count);
// process duplicates search results
foreach (var duplicates in imageDuplicatesSet.Duplicates)
{
Console.WriteLine("Duplicates:");
foreach (var duplicate in duplicates.DuplicateImages)
{
Console.WriteLine(
$"ImageName: {duplicate.ImageId}, Similarity: {duplicate.Similarity}");
}
// extract images features
foreach (FileInfo image in images)
{
CreateImageFeatures(image.Name, false, searchContextId);
}
/////////////////////
// Extract images features and add them to search context.
public static void CreateImageFeatures(string storageSourcePath, bool isFolder, string searchContextId)
{
var request = isFolder
? new CreateImageFeaturesRequest(searchContextId, imageId: null, imagesFolder: storageSourcePath, storage: null)
: new CreateImageFeaturesRequest(searchContextId, imageId: storageSourcePath, storage: null);
imagingApi.CreateImageFeatures(request);
}
// Create new search context
string searchContextId = CreateImageSearch();
////////////////
public static string CreateImageSearch()
{
string detector = "akaze";
string matchingAlgorithm = "randomBinaryTree";
string folder = null; // File will be saved at the root of the storage
string storage = null; // We are using default Cloud Storage
CreateImageSearchRequest createSearchContextRequest = new CreateImageSearchRequest(detector,matchingAlgorithm, folder, storage);
SearchContextStatus status = imagingApi.CreateImageSearch(createSearchContextRequest);
return status.Id;
}
// First get Access Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -X POST "https://api.aspose.cloud/connect/token"
-d "grant_type=client_credentials&client_id=[AppSID]&client_secret=[AppKey]"
-H "Content-Type: application/x-www-form-urlencoded"
-H "Accept: application/json"
//Upload soruce SVG image to Aspose default storage
curl -X PUT "https://api.aspose.cloud/v3.0/imaging/storage/file/Temp%2Fcs2cpp.svg"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: multipart/form-data"
-F "imageData=@C:/Temp/cs2cpp.svg"
//Update SVG image settings
curl -X GET "https://api.aspose.cloud/v3.0/imaging/test.svg/svg?colorType=Rgb&textAsShapes=true&scaleX=0&scaleY=0&bkColor=white&fromScratch=false&folder=Temp&format=svg"
-H "accept: application/json"
-H "authorization: Bearer [Acess_Token]"
--output C:/Temp/test_updated.svg
// First get Access Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -X POST "https://api.aspose.cloud/connect/token"
-d "grant_type=client_credentials&client_id=[AppSID]&client_secret=[AppKey]"
-H "Content-Type: application/x-www-form-urlencoded"
-H "Accept: application/json"
//Rasterize SVG image to PNG with scale setting
curl -X POST "https://api.aspose.cloud/v3.0/imaging/svg?colorType=Rgb&textAsShapes=false&scaleX=2&scaleY=2&bkColor=gray&fromScratch=false&format=png"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: multipart/form-data"
-F "imageData=@C:/Temp/Test.svg"
--output C:/Temp/Test.png
// Upload input images to Cloud Storage
DirectoryInfo dir = new DirectoryInfo(PathToDataFiles);
FileInfo[] images = dir.GetFiles();
foreach (FileInfo image in images)
{
// Upload local image to Cloud Storage
using (FileStream localInputImage = System.IO.File.OpenRead(image.FullName))
{
var uploadFileRequest = new UploadFileRequest(image.Name, localInputImage);
FilesUploadResult result = imagingApi.UploadFile(uploadFileRequest);
}
}
// Get App Key and App SID from https://dashboard.aspose.cloud/
// Instantiate Aspose BarCode Cloud API SDK
PdfApi pdfApi = new PdfApi(MyAppKey, MyAppSid);
string name = "Hello world.pdf";
string TempFolder = "Temp";
var field = new Aspose.Pdf.Cloud.Sdk.Model.Field(
Name: "checkboxfield",
Type: FieldType.Boolean,
Values: new List<string> { "1" },
Rect: new Rectangle(
LLX: 330,
LLY: 670,
URX: 340,
URY: 680
));
var response = pdfApi.PostCreateField(name, 1, field, folder: TempFolder);
Console.WriteLine(response);
// Get App Key and App SID from https://dashboard.aspose.cloud/
// Instantiate Aspose BarCode Cloud API SDK
PdfApi pdfApi = new PdfApi(MyAppKey, MyAppSid);
string name = "Hello world.pdf";
string TempFolder = "Temp";
var radioButtons = new List<RadioButtonField> {
new RadioButtonField(PageIndex: 1, IsGroup: false, Selected: 1)
{
Color = new Color(255, 255, 0, 0),
Rect = new Rectangle(75, 700, 150, 710),
PartialName = "testField",
Style = BoxStyle.Cross,
Margin = new MarginInfo{ Bottom = 0, Left = 0, Right = 0, Top = 0 },
RadioButtonOptionsField = new List<RadioButtonOptionField>
{
new RadioButtonOptionField(PageIndex: 1, IsGroup: false)
{
OptionName = "1",
Rect = new Rectangle(90, 700, 100, 710),
//Style = BoxStyle.Square
},
new RadioButtonOptionField(PageIndex: 1, IsGroup: false)
{
OptionName = "2",
Rect = new Rectangle(140, 700, 150, 710),
}
}
}
};
var response = pdfApi.PostRadioButtonFields(name, radioButtons, folder: TempFolder);
Console.WriteLine(response);
// Get App Key and App SID from https://dashboard.aspose.cloud/
Aspose.Slides.Cloud.Sdk.Configuration config = new Aspose.Slides.Cloud.Sdk.Configuration();
config.AppKey = MyAppKey;
config.AppSid = MyAppSid;
SlidesApi slidesApi = new SlidesApi(config);
var localfile = "C:/Temp/slide.pptx";
var format = ExportFormat.Pdf;
String password = null;
String fontFolder = null;
//Convert a Presentation from request body to PDF document and return as stream reponse
var request = new PostSlidesConvertRequest(format, System.IO.File.OpenRead(localfile), password, fontFolder);
var response = slidesApi.PostSlidesConvert(request);
//Save stream response as PDF on local drive
var fileStream = System.IO.File.Create("C:/Temp/test.pdf");
response.CopyTo(fileStream);
fileStream.Close();
// Get App Key and App SID from https://dashboard.aspose.cloud/
// Get Authenication Token(JWT)
curl "https://api.aspose.cloud/connect/token"
-X POST
-d "grant_type=client_credentials&client_id=[App_SID]&client_secret=[App_Key]"
-H "Content-Type: application/x-www-form-urlencoded" -H "Accept: application/json"
// Layout Mode of Chart Plot Area
curl -X POST "https://api.aspose.cloud/v3.0/slides/MyPresentationWideScreen.pptx/slides/2/shapes/undefined?folder=Temp"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: application/json"
-d "{ "type": "Chart", "shapeType": "Chart", "chartType": "ClusteredColumn",
"series":
[{ "dataPointType": "OneValue",
"dataPoints": [{ "value": 30.903210132803398 }, { "value": 93.970356133752659 }, { "value": 62.40113110393338 }],
"type": "ClusteredColumn", "name": "Seria 0", "isColorVaried": false }, { "dataPointType": "OneValue",
"dataPoints": [{ "value": 5.55788800379163 }, { "value": 76.488545432914307 }, { "value": 27.763909952605104 }],
"type": "ClusteredColumn", "name": "Seria 1", "isColorVaried": false }, { "dataPointType": "OneValue",
"dataPoints": [{ "value": 22.545063226737579 }, { "value": 94.39623946994368 }, { "value": 99.253436550150369 }],
"type": "ClusteredColumn", "name": "Seria 2", "isColorVaried": false }, { "dataPointType": "OneValue",
"dataPoints": [{ "value": 78.624130077019387 }, { "value": 57.199312121234513 }, { "value": 58.8933876524183 }],
"type": "ClusteredColumn", "name": "Seria 3", "isColorVaried": false }],
"categories": [ "Category 0", "Category 1", "Category 2" ],
"title": { "text": "Seasonal fluctuation", "hasTitle": false }, "name": "", "width": 600.0, "height": 500.0,
"alternativeText": "", "hidden": false, "x": 10.0, "y": 15.0,"LayoutTargetType": "Outer" "zOrderPosition": 0
}"
// Get App Key and App SID from https://dashboard.aspose.cloud/
// Get Authenication Token(JWT)
curl "https://api.aspose.cloud/connect/token"
-X POST
-d "grant_type=client_credentials&client_id=[App_SID]&client_secret=[App_Key]"
-H "Content-Type: application/x-www-form-urlencoded" -H "Accept: application/json"
// Set Presentation Slide Size
curl -X PUT "https://api.aspose.cloud/v3.0/slides/MyPresentationBanner.pptx/slideSize?folder=Temp&sizeType=Widescreen"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
import asposewordscloud
import asposewordscloud.models.requests
api_client = asposewordscloud.ApiClient()
# Get App key and App SID from https://cloud.aspose.com
api_client.configuration.host = 'https://api.aspose.cloud'
api_client.configuration.api_key['api_key'] = 'xxxxxxxxxxxxxxxxxxxxxxxxx' # Put your appKey here
api_client.configuration.api_key['app_sid'] = 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx' # Put your appSid here
words_api = asposewordscloud.WordsApi(api_client)
filename = 'TestFile.docx'
remote_name = 'TestPostDocumentSaveAs.docx'
dest_name = 'TestPostDocumentSaveAs.epub'
#upload DOCX file to storage
request_upload = asposewordscloud.models.requests.UploadFileRequest(filename,remote_name)
response_upload = words_api.upload_file(request_upload)
#Convert DOCX to EPUB and save to storage
save_options = asposewordscloud.SaveOptionsData(save_format='epub', file_name=dest_name)
request_conversion = asposewordscloud.models.requests.SaveAsRequest(remote_name, save_options)
response_conversion = words_api.save_as(request_conversion)
print(response_conversion)
For complete examples and data files, please go to https://github.com/aspose-words-cloud/aspose-words-cloud-dotnet
string MyAppKey = "xxxxxxxxxxxxxxxxxxxxxxx"; // Get AppKey and AppSID from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxx-xxxx-xxxxx-xxxxx-xxxxx"; // Get AppKey and AppSID from https://dashboard.aspose.cloud/
WordsApi wordsApi = new WordsApi(MyAppKey, MyAppSid);
var localName = "Test.docx";
var remoteName = "Test.docx";
var folder = "Temp";
var fullName = Path.Combine(folder, remoteName);
var body = new TiffSaveOptionsData { FileName = "abc.tiff", SaveFormat = "tiff" };
body.ImageColorMode = "Grayscale";
body.TiffBinarizationMethod = "FloydSteinbergDithering";
body.ThresholdForFloydSteinbergDithering = 254;
body.TiffCompression = "Ccitt3";
//upload source Word document to Aspsoe default storage
wordsApi.UploadFile(new Aspose.Words.Cloud.Sdk.Model.Requests.UploadFileRequest(System.IO.File.OpenRead(localName),fullName));
// Convert Word document to TIFF
var request = new SaveAsTiffRequest(remoteName,body,folder);
var actual =wordsApi.SaveAsTiff(request);
Console.WriteLine(actual);
// First get JSON Web Token for authentication
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
// First get JSON Web Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
// cURL example to populate MailMerge template with Data
curl -v "https://api.aspose.cloud/v4.0/words/SampleMailMergeTemplate.docx/MailMerge?destFileName=TestPostDocumentExecuteMailMerge.docx" \
-X PUT \
-F data=@SampleMailMergeTemplateData.txt \
-H "Content-Type: multipart/form-data" \
-H "Accept: application/json" \
-H "Authorization: Bearer [jwt token]"
// First get JSON Web Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
// cURL example to populate Mustache template with Data
curl -v "https://api.aspose.cloud/v4.0/words/TestExecuteTemplate.doc/MailMerge?destFileName=TestPostExecuteTemplate.docx" \
-X PUT \
-F data=@TestExecuteTemplateData.txt \
-H "Content-Type: multipart/form-data" \
-H "Accept: application/json" \
-H "Authorization: Bearer [jwt token]"
// First get Access Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/oauth2/token" \
-X POST \
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
// First get JSON Web Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
// cURL example to insert page numbers into a document
curl -v "https://api.aspose.cloud/v4.0/words/test_multi_pages.docx/PageNumbers" \
-X PUT \
-d '{ "Format": "{PAGE} of {NUMPAGES}", "Alignment": "right", "IsTop": true, "SetPageNumberOnFirstPage": true }' \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer [jwt token]"
// First get Access Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl "https://api.aspose.cloud/oauth2/token"
-X POST
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]"
-H "Content-Type: application/x-www-form-urlencoded"
-H "Accept: application/json"
// cURL example to upload file to Aspose Cloud Storage
curl "https://api.aspose.cloud/v1.1/storage/file?path=multilevellist.pdf"
-X PUT
-T C:/Temp/multilevellist.pdf
-H "Content-Type: multipart/form-data"
-H "Accept: application/json"
-H "Authorization: Bearer [ACCESS_TOKEN]"
// cURL example to convert PDF Document to Word
curl "https://api.aspose.cloud/v1.1/words/multilevellist.pdf/saveAs"
-X POST
-H "Content-Type: application/json"
-d '{"SaveFormat": "docx","FileName": "multilevellistapi.docx",}'
-H "Accept: application/json"
-H "Authorization: Bearer [ACCESS_TOKEN]"
///////////////////V4///////////////////////
// First get JSON Web Token
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
// cURL example to upload file to Aspose Cloud Storage
curl "https://api.aspose.cloud/v4.0/words/storage/file/sample.pptx"
-X PUT
-H "accept: application/json"
-H "Content-Type: multipart/form-data"
-T C:/sample.pptx
-H "authorization: Bearer [ACCESS_TOKEN]"
// cURL example to convert PDF Document to Word
curl "https://api.aspose.cloud/v4.0/words/multilevellist.pdf/saveAs"
-X PUT
-H "Content-Type: application/json"
-d "{"SaveFormat": "docx","FileName": "multilevellistapi.docx",}"
-H "Accept: application/json"
-H "authorization: Bearer [ACCESS_TOKEN]"
curl -X PUT "https://https://api.aspose.cloud/v4.0/words/Test.PDF/saveAs?password=ownerpassword"
-H "accept: application/xml"
-H "Content-Type: application/json"
-d "{ \"SaveFormat\": \"docx\", \"FileName\": \"Text.docx\",}"
-H "authorization: Bearer [ACCESS_TOKEN]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.