Before you can make any requests to GroupDocs Cloud API you need to get Client Id and Client Secret. That will be used to invoke the GroupDocs Cloud API.
GroupDocs.Viewer Cloud SDK is written in different languages, all you need to get started is adding our SDK to your project.
Make an API request
Use the Client Id and Client Secret from the API app client you created in step one and replace in the corresponding code. Below is an example demonstrating how to preview document using GroupDocs.Viewer Cloud.
Note
The GitHub repository for GroupDocs.Viewer Cloud has a complete set of examples, demonstrating our API capabilities.
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-dotnet-samplesstringMyClientSecret="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloudstringMyClientId="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloudvarconfiguration=newConfiguration(MyClientId,MyClientSecret);varapiInstance=newViewApi(configuration);varformat="jpg";varrequest=newConvertAndDownloadRequest(format,File.OpenRead("myfile.txt"));varresult=apiInstance.ConvertAndDownload(request);
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-php-samples
useGroupDocs\Viewer\Model;useGroupDocs\Viewer\Model\Requests;$ClientId="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
$ClientSecret="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
$configuration=newGroupDocs\Viewer\Configuration();$configuration->setAppSid($ClientId);$configuration->setAppKey($ClientSecret);$apiInstance=newGroupDocs\Viewer\ViewApi($configuration);$format="jpg";$path=__DIR__.'myfile.txt';$request=newRequests\convertAndDownloadRequest($format,$path);$result=$apiInstance->convertAndDownload($request);
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-java-samples
stringMyClientSecret="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
stringMyClientId="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
Configurationconfiguration=newConfiguration(MyClientId,MyClientSecret);ViewApiapiInstance=newViewApi(configuration);Stringformat="pdf";FilefileObj=newFile("myfile.txt");ConvertAndDownloadRequestrequest=newConvertAndDownloadRequest(format,fileObj,null,null);Filefile=apiInstance.convertAndDownload(request);
# For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-ruby-samplesrequire'groupdocs_viewer_cloud'$client_id="XXXX-XXXX-XXXX-XXXX"# Get Client Id and Client Secret from https://dashboard.groupdocs.cloud$client_secret="XXXXXXXXXXXXXXXX"# Get Client Id and Client Secret from https://dashboard.groupdocs.cloudapiInstance=GroupDocsViewerCloud::ViewApi.from_keys($client_id,$client_secret)format="jpg"file=File.open("myfile.txt","r")request=ConvertAndDownloadRequest.newformat,fileresponse=apiInstance.convert_and_download(request)
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-node-samples
global.viewer#require("groupdocs-viewer-cloud");global.clientId="XXXX-XXXX-XXXX-XXXX";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
global.clientSecret="XXXXXXXXXXXXXXXX";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
global.viewApi=viewer_cloud.ViewApi.fromKeys(clientId,clientSecret);varformat="jpg";letfilebuf=fs.readFileSync("myfile.txt");varrequest=newConvertAndDownloadRequest(format,filebuf);letresponse=awaitviewApi.convertAndDownload(request);
# For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-python-samplesimportgroupdocs_viewer_cloudclient_id="XXXX-XXXX-XXXX-XXXX"# Get Client Id and Client Secret from https://dashboard.groupdocs.cloudclient_secret="XXXXXXXXXXXXXXXX"# Get Client Id and Client Secret from https://dashboard.groupdocs.cloudapiInstance=groupdocs_viewer_cloud.ViewApi.from_keys(client_id,client_secret)format="jpg"file=File.open("myfile.txt","r")request=ConvertAndDownloadRequest.newformat,fileresponse=apiInstance.convert_and_download(request)
packagebasicUsageimport("fmt""os""github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-go-samples/config")funcConvertAndDownload(){// Open the file to be converted
file,err:=os.Open("Resources/SampleFiles/sample.docx")iferr!=nil{fmt.Printf("Exception: %v\n",err)return}deferfile.Close()// Call the API
response,_,err:=config.Client.ViewApi.ConvertAndDownload(config.Ctx,"jpg",file,nil)iferr!=nil{fmt.Printf("Exception: %v\n",err)return}fileInfo,err:=response.Stat()iferr!=nil{fmt.Printf("Exception: %v\n",err)return}fmt.Printf("ConvertAndDownload completed: %v bytes received\n",fileInfo.Size())}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.
On this page
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.