Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This Gist contains examples of groupdocs.cloud APIs for Blog Posts
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
using System;
using System.Diagnostics;
using GroupDocs.Classification.Cloud.Sdk.Api;
using GroupDocs.Classification.Cloud.Sdk.Model;
using GroupDocs.Classification.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Classification.Cloud.Sdk.Examples
{
class Classification_CSharp_Classify_Document_from_Storage
{
public static void Run()
{
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud/ (free registration is required).
var configuration = new Configuration
{
AppSid = "XXX-XXXXXXX-XXXX",
AppKey = "XXXXXXXXXXXXX"
};
var apiInstance = new ClassificationApi(configuration);
try
{
var request = new ClassifyRequest(new BaseRequest()
{
Document = new FileInfo()
{
Name = "one-page.docx",
Folder = ""
},
},
bestClassesCount: "3");
// Get classification results
ClassificationResponse response = apiInstance.Classify(request);
Console.WriteLine(response.ToString());
}
catch (Exception e)
{
Console.WriteLine("Exception when calling ClassificationApi.Classify: " + e.Message);
}
}
}
}
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
using System;
using System.Diagnostics;
using GroupDocs.Classification.Cloud.Sdk.Api;
using GroupDocs.Classification.Cloud.Sdk.Model;
using GroupDocs.Classification.Cloud.Sdk.Model.Requests;
namespace GroupDocs.Classification.Cloud.Sdk.Examples
{
class Classification_CSharp_Classify_Raw_Text
{
public static void Run()
{
//TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud/ (free registration is required).
var configuration = new Configuration
{
AppSid = "XXX-XXXXXXX-XXXX",
AppKey = "XXXXXXXXXXXXX"
};
var apiInstance = new ClassificationApi(configuration);
try
{
var request = new ClassifyRequest(new BaseRequest() { Description = "Try Text classification using GroupDocs.Classification Cloud API" }, "3");
// Get classification results
var response = apiInstance.Classify(request);
Console.WriteLine(response.ToString());
}
catch (Exception e)
{
Console.WriteLine("Exception when calling ClassificationApi.Classify: " + e.Message);
}
}
}
}
GroupDocs-Cloud-Blog
using GroupDocs.Viewer.Cloud.Sdk.Api;
using GroupDocs.Viewer.Cloud.Sdk.Client;
using GroupDocs.Viewer.Cloud.Sdk.Model;
using GroupDocs.Viewer.Cloud.Sdk.Model.Requests;
using System;
namespace GroupDocs.Viewer.Cloud.Examples.CSharp
{
// Get Document Information With CAD Options
class Get_Info_With_CAD_Options
{
public static void Run()
{
var configuration = new Configuration(Common.MyAppSid, Common.MyAppKey);
var apiInstance = new InfoApi(configuration);
try
{
var viewOptions = new ViewOptions()
{
FileInfo = new FileInfo()
{
FilePath = "viewerdocs/three-layouts.dwf",
Password = "",
StorageName = Common.MyStorage
},
RenderOptions = new RenderOptions()
{
CadOptions = new CadOptions()
{
ScaleFactor = 5f;
Height = 600;
Width = 800
}
}
};
var request = new GetInfoRequest(viewOptions);
var response = apiInstance.GetInfo(request);
Console.WriteLine("Expected response type is InfoResult: " + response.Pages.Count.ToString());
}
catch (Exception e)
{
Console.WriteLine("Exception while calling InfoApi: " + e.Message);
}
}
}
}
curl -X POST "https://api.groupdocs.cloud/v2.0/annotation?filePath=annotationdocs%2one-page.pdf"
-H "accept: application/json" -H "authorization: Bearer [Access Token]"
-H "Content-Type: application/json" -d "[ { \"guid\": null,
\"documentGuid\": 0, \"text\": null, \"creatorGuid\": null,
\"creatorName\": \"Anonym A.\", \"creatorEmail\": null, \"box\": { \"x\": 375.892761,
\"y\": 59.3882637, \"width\": 88.7330551, \"height\": 37.7290154 }, \"pageNumber\": 0, \"annotationPosition\": { \"x\": 852, \"y\": 59.38826291079812 }, \"svgPath\": null,
\"type\": 1, \"access\": null, \"replies\": null, \"createdOn\": \"0001-01-01T00:00:00\", \"fontColor\": null, \"penColor\": 1201033, \"penWidth\": 1, \"penStyle\": 0,
\"backgroundColor\": null, \"fieldText\": null, \"fontFamily\": null, \"fontSize\": null,
\"opacity\": null, \"angle\": null }]"
### Add annotation to source document
curl -X POST "https://api.groupdocs.cloud/v2.0/annotation?filePath=02_pages.pdf"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: application/json"
-d "[
{
"guid": null,
"documentGuid": 0,
"text": null,
"creatorGuid": null,
"creatorName": "Anonym A.",
"creatorEmail": null,
"svgPath":"[{'x':55.2986,'y':613.5769},{'x':260.7985,'y':613.5769},{'x':55.2986,'y':600.5769},{'x':260.7985,'y':600.5769}]",
"type": 9,
"access": null,
"replies": null,
"createdOn": "0001-01-01T00:00:00",
"fontColor": null,
"penColor": 1201033,
"penWidth": 1,
"penStyle": 0,
"backgroundColor": null,
"fieldText": null,
"fontFamily": null,
"fontSize": null,
"opacity": null,
"angle": null
}
]"
curl -X Delete "https://api.groupdocs.cloud/v2.0/annotation?filePath=annotationdocs%2Fone-page.pdf"
-H "accept: application/json" -H "authorization: Bearer [Access token]"
curl -X GET "https://api.groupdocs.cloud/v2.0/annotation/storage/file/one-page.pdf?storageName=MyStorage"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access Token]"
curl -X POST "https://api.groupdocs.cloud/v2.0/signature/create"
-H "accept: application/json" -H "authorization: Bearer [Access Token]"
-H "Content-Type: application/json" -d "{ \"FileInfo\": { \"FilePath\": \"one-page.docx\", \"StorageName\": \"MyStorage\", \"VersionId\": \"\",
\"Password\": \"\" }, \"SaveOptions\": { \"OverwriteExisting\": true, \"OutputFilePath\": \"result-one-page.docx\", \"SaveFormat\": \"docx\" },
\"SignOptions\": [ { \"DocumentType\": \"WordProcessing\", \"SignatureType\": \"Barcode\", \"Page\": 1, \"AllPages\": false,
\"PagesSetup\": { \"FirstPage\": false, \"LastPage\": true, \"OddPages\": false, \"EvenPages\": true, \"PageNumbers\": [1] },
\"Text\": \"John Smith\", \"BarcodeType\": \"Code128\", \"Left\": 2, \"Top\": 2, \"Width\": 200, \"Height\": 100, \"Stretch\": \"None\",
\"RotationAngle\": 45, \"HorizontalAlignment\": \"Left\", \"VerticalAlignment\": \"Center\", \"LocationMeasureType\": \"Pixels\", \"SizeMeasureType\": \"Pixels\",
\"Margin\": { \"All\": 5, \"Left\": 5, \"Top\": 5, \"Right\": 5, \"Bottom\": 5 }, \"MarginMeasureType\": \"Pixels\",
\"Font\": { \"FontFamily\": \"Times New Roman\", \"FontSize\": 14.0, \"Bold\": false, \"Italic\": false, \"Underline\": false },
\"ForeColor\": { \"Web\": \"DarkOrange\" }, \"BorderColor\": { \"Web\": \"DarkOrange\", \"Alpha\": \"20\", },
\"BackgroundBrush\": { \"Color\": {\"Web\": \"DarkBlue\"}, \"BrushType\": \"SolidBrush\" },
\"BorderVisiblity\": true, \"BorderDashStyle\": \"Dash\", \"BorderTransparency\": 0.55, \"BorderWeight\": 12.0, \"BackgroundTransparency\": 0.8,
\"TextHorizontalAlignment\": \"Left\", \"TextVerticalAlignment\": \"Top\", \"Opacity\": 0.5, \"CodeTextAlignment\": \"Below\",
\"InnerMargins\": { \"All\": 5, \"Left\": 5, \"Top\": 5, \"Right\": 5, \"Bottom\": 5 },} ]}"
### Download annotated document
curl -X GET "https://api.groupdocs.cloud/v2.0/annotation/result?filePath=02_pages.pdf&annotatedPages=false&firstPage=-1&lastPage=-1"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
--output C:/Temp/02_pages_output.pdf
curl -X POST "https://api.groupdocs.cloud/v2.0/annotation/storage/file/annotationdocs/one-page.pdf?storageName=MyStorage"
-H "accept: application/json"
-H "authorization: Bearer [Access Token]"
### Upload document to default storage
curl -X POST "https://api.groupdocs.cloud/v2.0/annotation/storage/file/02_pages.pdf"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: multipart/form-data"
-F "File=@C:/Temp/02_pages.pdf"
curl -v "http://api.groupdocs.com/v/v1/classification/classify?bestClassesCount=3&taxonomy=documents"
-H "content-type: application/json"
-X POST -d '{ "Document": {"Folder": "words/docx","Name": "four-pages.docx" } }'
{
"bestClassName": "Other",
"bestClassProbability": 36.8,
"bestResults": [
{
"className": "Other",
"classProbability": 36.8
},
{
"className": "ADVE",
"classProbability": 14.72
},
{
"className": "News",
"classProbability": 12.77
}
],
"code": 200,
"status": "OK"
}
### Upload document to default storage
curl -X POST "https://api.groupdocs.cloud/v2.0/viewer/storage/file/viewerdocs%2Fthree-layouts.dwf?storageName=MyStorage"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: multipart/form-data"
-T C:/Temp/three-layouts.dwf
{
"bestClassName": "Healthy_Living",
"bestClassProbability": 53.77,
"bestResults": [
{
"className": "Healthy_Living",
"classProbability": 53.77
},
{
"className": "Medical_Health",
"classProbability": 38.27
},
{
"className": "Pets",
"classProbability": 1.98
}
],
"code": 200,
"status": "OK"
}
### Compare source and target document and get the comparison result document
curl -X POST "https://api.groupdocs.cloud/v2.0/comparison/comparisons"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: application/json"
-d "{"SourceFile": {"FilePath": "source.docx",},"TargetFiles": [{"FilePath": "target.docx",}],"OutputPath": "result.docx"}"
### Download document from default storage
curl -X GET "https://api.groupdocs.cloud/v2.0/comparison/storage/file/result.docx"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access_Token]"
-o "C:/Temp/result.docx"
### Upload document to default storage
curl -X POST "https://api.groupdocs.cloud/v2.0/comparison/storage/file/source.docx"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: multipart/form-data"
-T C:/Temp/source.docx
// Optimize PDF document for Web
curl -X POST "https://api.groupdocs.cloud/v2.0/conversion"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: application/json"
-d "{ "FilePath": "Test.pdf", "Format": "pdf", "ConvertOptions": {"linearize": true }}"
--output C:/Temp/Test_linerized.pdf
// Optimize PDF document size
curl -X POST "https://api.groupdocs.cloud/v2.0/conversion"
-H "accept: application/json"
-H "authorization: Bearer [Acess_Token]"
-H "Content-Type: application/json"
-d "{ "FilePath": "Test.pdf", "Format": "pdf", "ConvertOptions": { "linkDuplicateStreams": true, "removeUnusedObjects": true, "removeUnusedStreams": true, "compressImages": true, "imageQuality": 10, "unembedFonts": false }}"
--output C:/Temp/Test_optimized.pdf
# Import module
import groupdocs_conversion_cloud
# Get your app_sid and app_key at https://dashboard.groupdocs.cloud (free registration is required).
app_sid = "xxxxx-xxxx-xxxx-xxxx-xxxxxxxx"
app_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# Create instance of the API
convert_api = groupdocs_conversion_cloud.ConvertApi.from_keys(app_sid, app_key)
file_api = groupdocs_conversion_cloud.FileApi.from_keys(app_sid, app_key)
try:
#upload soruce file to storage
filename = '02_pages.pdf'
remote_name = '02_pages.pdf'
output_name= 'sample.txt'
strformat='txt'
request_upload = groupdocs_conversion_cloud.UploadFileRequest(remote_name,filename)
response_upload = file_api.upload_file(request_upload)
#Extract Text from PDF document
settings = groupdocs_conversion_cloud.ConvertSettings()
settings.file_path =remote_name
settings.format = strformat
settings.output_path = output_name
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings)
response = convert_api.convert_document(request)
print("Document converted successfully: " + str(response))
except groupdocs_conversion_cloud.ApiException as e:
print("Exception when calling get_supported_conversion_types: {0}".format(e.message))
Document converted successfully: [{'name': 'sample.txt',
'path': 'sample.txt',
'size': 791,
'url': 'https://api.groupdocs.cloud/v2.0/conversion/storage/file/sample.txt'}]
#Convert PDF to Word document
settings = groupdocs_conversion_cloud.ConvertSettings()
settings.file_path =remote_name
settings.format = strformat
settings.output_path = output_name
loadOptions = groupdocs_conversion_cloud.PdfLoadOptions()
loadOptions.hide_pdf_annotations = True
loadOptions.remove_embedded_files = False
loadOptions.flatten_all_fields = True
settings.load_options = loadOptions
convertOptions = groupdocs_conversion_cloud.DocxConvertOptions()
convertOptions.from_page = 1
convertOptions.pages_count = 1
settings.convert_options = convertOptions
request = groupdocs_conversion_cloud.ConvertDocumentRequest(settings)
response = convert_api.convert_document(request)
print("Document converted successfully: " + str(response))
except groupdocs_conversion_cloud.ApiException as e:
print("Exception when calling get_supported_conversion_types: {0}".format(e.message))
# Import module
import groupdocs_conversion_cloud
# Get your app_sid and app_key at https://dashboard.groupdocs.cloud (free registration is required).
app_sid = "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxx"
app_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# Create instance of the API
convert_api = groupdocs_conversion_cloud.ConvertApi.from_keys(app_sid, app_key)
file_api = groupdocs_conversion_cloud.FileApi.from_keys(app_sid, app_key)
Document converted successfully: [{'name': 'sample.docx',
'path': 'sample.docx',
'size': 4078202,
'url': 'https://api.groupdocs.cloud/v2.0/conversion/storage/file/sample.docx'}]
try:
#upload soruce file to storage
filename = '02_pages.pdf'
remote_name = '02_pages.pdf'
output_name= 'sample.docx'
strformat='docx'
request_upload = groupdocs_conversion_cloud.UploadFileRequest(remote_name,filename)
response_upload = file_api.upload_file(request_upload)
var configuration = new GroupDocs.Merger.Cloud.Sdk.Client.Configuration(MyAppSid, MyAppKey);
var apiInstance_Document = new GroupDocs.Merger.Cloud.Sdk.Api.DocumentApi(configuration);
var apiInstance_File = new GroupDocs.Merger.Cloud.Sdk.Api.FileApi(configuration);
var pathToSourceFiles = @"C:/Temp/input/";
var remoteFolder = "Temp/";
var joinItem_list = new List<JoinItem>();
try
{
DirectoryInfo dir = new DirectoryInfo(pathToSourceFiles);
System.IO.FileInfo[] files = dir.GetFiles();
foreach (System.IO.FileInfo file in files)
{
var request_upload = new GroupDocs.Merger.Cloud.Sdk.Model.Requests.UploadFileRequest(remoteFolder + file.Name, File.Open(file.FullName, FileMode.Open));
var response_upload = apiInstance_File.UploadFile(request_upload);
var item = new JoinItem
{
FileInfo = new GroupDocs.Merger.Cloud.Sdk.Model.FileInfo
{ FilePath = remoteFolder + file.Name }
};
joinItem_list.Add(item);
}
var options = new JoinOptions
{
JoinItems = joinItem_list,
OutputPath = remoteFolder + "Merged_Document.docx"
};
var request = new JoinRequest(options);
var response = apiInstance_Document.Join(request);
Console.WriteLine("Output file path: " + response.Path);
}
catch (Exception e)
{
Console.WriteLine("Exception while Merging Documents: " + e.Message);
}
// First get Access Token
// Get App Key and App SID from https://dashboard.groupdocs.cloud/
curl -X POST "https://api.groupdocs.cloud/connect/token"
-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"
// Upload soruce document to GrupDocs default Storage
curl -X PUT "https://api.groupdocs.cloud/v1.0/merger/storage/file/Temp/Test1.docx"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: multipart/form-data"
-F "File=@C:/Temp/Testv1.docx"
// Merge Documents from GroupDocs default Storage
curl -X POST "https://api.groupdocs.cloud/v1.0/merger/join"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: application/json" -d "{ "JoinItems": [ { "FileInfo": { "FilePath": "Temp/Testv1.docx", } },{ "FileInfo": { "FilePath": "Temp/Test2.docx", } },{ "FileInfo": { "FilePath": "Temp/Test3.docx", } } ], "OutputPath": "Temp/GroupDocs_Merger.docx"}"
// First get Access Token
// Get App Key and App SID from https://dashboard.groupdocs.cloud/
curl -X POST "https://api.groupdocs.cloud/connect/token"
-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"
// Create Template for parsing and save to GroupDocs default Storage
curl -X PUT "https://api.groupdocs.cloud/v1.0/parser/template"
-H "accept: application/json"
-H "authorization: Bearer [Access_TOken]"
-H "Content-Type: application/json"
-d "{
"Template": {
"Fields": [
{
"FieldName": "Address",
"FieldPosition": {
"FieldPositionType": "Regex",
"Regex": "Company address:",
"MatchCase": false,
"IsLeftLinked": false,
"IsRightLinked": false,
"IsTopLinked": false,
"IsBottomLinked": false,
"AutoScale": false
}
},
{
"FieldName": "CompanyAddress",
"FieldPosition": {
"FieldPositionType": "Linked",
"MatchCase": false,
"LinkedFieldName": "ADDRESS",
"IsLeftLinked": false,
"IsRightLinked": true,
"IsTopLinked": false,
"IsBottomLinked": false,
"SearchArea": {
"Height": 10.0,
"Width": 100.0
},
"AutoScale": true
}
},
{
"FieldName": "Company",
"FieldPosition": {
"FieldPositionType": "Regex",
"Regex": "Company name:",
"MatchCase": false,
"IsLeftLinked": false,
"IsRightLinked": false,
"IsTopLinked": false,
"IsBottomLinked": false,
"AutoScale": false
}
},
{
"FieldName": "CompanyName",
"FieldPosition": {
"FieldPositionType": "Linked",
"MatchCase": false,
"LinkedFieldName": "Company",
"IsLeftLinked": false,
"IsRightLinked": true,
"IsTopLinked": false,
"IsBottomLinked": false,
"SearchArea": {
"Height": 10.0,
"Width": 100.0
},
"AutoScale": true
}
}
],
"Tables": [
{
"TableName": "Companies",
"DetectorParameters": {
"Rectangle": {
"Position": {
"X": 77.0,
"Y": 279.0
},
"Size": {
"Height": 60.0,
"Width": 480.0
}
}
}
}
]
},
"TemplatePath": "Temp/companies.json"
}"
// First get Access Token
// Get App Key and App SID from https://dashboard.groupdocs.cloud/
curl -X POST "https://api.groupdocs.cloud/connect/token"
-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"
// Upload soruce document to GrupDocs default Storage
curl -X PUT "https://api.groupdocs.cloud/v1.0/parser/storage/file/Temp/companies.docx"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: multipart/form-data"
-F "File=@C:/Temp/companies.docx"
// Parse by template stored in GroupDocs default Storage
curl -X POST "https://api.groupdocs.cloud/v1.0/parser/parse"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: application/json"
-d "{ "FileInfo": { "FilePath": "Temp/companies.docx", }, "TemplatePath": "Temp/companies.json"}"
### Download document from default storage
curl -X GET "https://api.groupdocs.cloud/v2.0/signature/storage/file/one-page.docx?storageName=MyStorage"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access Token]"
curl -X POST "https://api.groupdocs.cloud/v2.0/signature/search"
-H "accept: application/json"
-H "authorization: Bearer [Access Token]"
-H "Content-Type: application/json" -d "{ \"FileInfo\": {\"FilePath\": \"signaturedocs/one-page.pdf\",\"StorageName\": \"MyStorage\",
\"VersionId\": \"\", \"Password\": \"\" }, \"SearchOptions\": [ {\"DocumentType\": \"Pdf\",\"SignatureType\": \"Barcode\",
\"Page\": 1,\"Text\": \"123\",\"BarcodeType\": \"Code128\",\"MatchType\": \"Contains\"}] }"
curl -X POST "https://api.groupdocs.cloud/v2.0/signature/create"
-H "accept: application/json" -H "authorization: Bearer [Access Token]"
-H "Content-Type: application/json" -d "{ \"FileInfo\": { \"FilePath\": \"one-page.docx\", \"StorageName\": \"MyStorage\", \"VersionId\": \"\",
\"Password\": \"\" }, \"SaveOptions\": { \"OverwriteExisting\": true, \"OutputFilePath\": \"result-one-page.docx\", \"SaveFormat\": \"docx\" },
\"SignOptions\": [ { \"DocumentType\": \"WordProcessing\", \"SignatureType\": \"Barcode\", \"Page\": 1, \"AllPages\": false,
\"PagesSetup\": { \"FirstPage\": false, \"LastPage\": true, \"OddPages\": false, \"EvenPages\": true, \"PageNumbers\": [1] },
\"Text\": \"John Smith\", \"BarcodeType\": \"Code128\", \"Left\": 2, \"Top\": 2, \"Width\": 200, \"Height\": 100, \"Stretch\": \"None\",
\"RotationAngle\": 45, \"HorizontalAlignment\": \"Left\", \"VerticalAlignment\": \"Center\", \"LocationMeasureType\": \"Pixels\", \"SizeMeasureType\": \"Pixels\",
\"Margin\": { \"All\": 5, \"Left\": 5, \"Top\": 5, \"Right\": 5, \"Bottom\": 5 }, \"MarginMeasureType\": \"Pixels\",
\"Font\": { \"FontFamily\": \"Times New Roman\", \"FontSize\": 14.0, \"Bold\": false, \"Italic\": false, \"Underline\": false },
\"ForeColor\": { \"Web\": \"DarkOrange\" }, \"BorderColor\": { \"Web\": \"DarkOrange\", \"Alpha\": \"20\", },
\"BackgroundBrush\": { \"Color\": {\"Web\": \"DarkBlue\"}, \"BrushType\": \"SolidBrush\" },
\"BorderVisiblity\": true, \"BorderDashStyle\": \"Dash\", \"BorderTransparency\": 0.55, \"BorderWeight\": 12.0, \"BackgroundTransparency\": 0.8,
\"TextHorizontalAlignment\": \"Left\", \"TextVerticalAlignment\": \"Top\", \"Opacity\": 0.5, \"CodeTextAlignment\": \"Below\",
\"InnerMargins\": { \"All\": 5, \"Left\": 5, \"Top\": 5, \"Right\": 5, \"Bottom\": 5 },} ]}"
### Upload document to default storage
curl -X POST "https://api.groupdocs.cloud/v2.0/signature/storage/file/signaturedocs%2Fone-page.docx?storageName=MyStorage"
-H "accept: application/json"
-H "authorization: Bearer [Access Token]"
curl -X POST "https://api.groupdocs.cloud/v2.0/signature/verify"
-H "accept: application/json"
-H "authorization: Bearer [Access Token]"
-H "Content-Type: application/json" -d "{\"FileInfo\": {\"FilePath\": \"signed/Signed_BarCode.pdf\",\"StorageName\": \"MyStorage\",
\"VersionId\": \"\", \"Password\": \"\",},\"VerifyOptions\": [{\"DocumentType\": \"Pdf\",
\"SignatureType\": \"Text\",\"Page\": 1,\"Text\": \"John\",\"MatchType\": \"Contains\"}] }}} ]}"
### Create HTML View with CAD Options
curl -X POST "https://api.groupdocs.cloud/v2.0/viewer/view"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: application/json"
-d "{ \"FileInfo\": { \"FilePath\": \"viewerdocs/three-layouts.dwf\", \"StorageName\": \"MyStorage\", \"Password\": \"\" }, \"CadOptions\": { \"ScaleFactor\": \"5f\", } }"
### Download document from default storage
curl -X GET "https://api.groupdocs.cloud/v2.0/viewer/storage/file/viewerdocs%2Fthree-layouts_page1.html?storageName=MyStorage"
-H "accept: multipart/form-data"
-H "authorization: Bearer [Access_Token]"
-o "C:/Temp/three-layouts_page1.html"
### Upload document to default storage
curl -X POST "https://api.groupdocs.cloud/v2.0/viewer/storage/file/viewerdocs%2Fthree-layouts.dwf?storageName=MyStorage"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: multipart/form-data"
-T C:/Temp/three-layouts.dwf
### Retrieve access token JWT(JSON Web Token)
### TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
curl --request POST https://api.groupdocs.cloud/connect/token
--header "Content-Type: application/x-www-form-urlencoded"
--data "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]"
import com.groupdocs.cloud.viewer.api.*;
import com.groupdocs.cloud.viewer.client.ApiException;
import com.groupdocs.cloud.viewer.model.*;
import com.groupdocs.cloud.viewer.model.requests.*;
import examples.Utils;
public class Viewer_Java_Create_View_With_HTML_ViewOptions {
public static void main(String[] args) {
//Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
ViewApi apiInstance = new ViewApi(Utils.AppSID, Utils.AppKey);
try {
ViewOptions viewOptions = new ViewOptions();
FileInfo fileInfo = new FileInfo();
fileInfo.setFilePath("viewerdocs\\three-layouts.dwf");
fileInfo.setPassword("");
fileInfo.setStorageName(Utils.MYStorage);
viewOptions.setFileInfo(fileInfo);
HtmlOptions renderOptions = new HtmlOptions();
renderOptions.setExternalResources(true);
renderOptions.defaultFontName("Arial");
viewOptions.setRenderOptions(renderOptions);
CreateViewRequest request = new CreateViewRequest(viewOptions);
ViewResult response = apiInstance.createView(request);
System.out.println("Expected response type is ViewResult: " + response.getPages().size());
} catch (ApiException e) {
System.err.println("Exception while calling ViewApi:");
e.printStackTrace();
}
}
}
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.