Skip to content

Commit 40b01ff

Browse files
Added page about deleting rendered document
1 parent 7051e6d commit 40b01ff

3 files changed

Lines changed: 276 additions & 2 deletions

File tree

Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
---
2+
id: "delete-rendered-document"
3+
url: "viewer/delete-rendered-document"
4+
title: "Delete rendered document"
5+
productName: "GroupDocs.Viewer Cloud"
6+
weight: 5
7+
description: ""
8+
keywords: ""
9+
---
10+
11+
# Introduction #
12+
13+
After rendering various types of documents into HTML, Image, or Pdf, you may clean (delete) rendered pages from cloud storage using special method.
14+
Note: This method deletes only output files, the input file remains in the storage.
15+
16+
Following example demonstrates on how to delete rendered document results.
17+
18+
## API Usage ##
19+
20+
[Swagger UI](https://apireference.groupdocs.cloud/viewer/) lets you call this REST API directly from the browser.
21+
22+
## cURL REST Example ##
23+
24+
{{< tabs tabTotal="2" tabID="1" tabName1="Request" tabName2="Response" >}} {{< tab tabNum="1" >}}
25+
26+
```html
27+
28+
* First get JSON Web Token
29+
* Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications. Kindly place Client Id in "client_id" and Client Secret in "client_secret" argument.
30+
curl -v "https://api.groupdocs.cloud/connect/token" \
31+
-X POST \
32+
-d "grant_type=client_credentials&client_id=xxxx&client_secret=xxxx" \
33+
-H "Content-Type: application/x-www-form-urlencoded" \
34+
-H "Accept: application/json"
35+
36+
* cURL example to delete rendered document files
37+
curl -v "https://api.groupdocs.cloud/v2.0/viewer/view" \
38+
-X DELETE \
39+
-H "Content-Type: application/json" \
40+
-H "Accept: application/json" \
41+
-H "Authorization: Bearer <jwt token>"
42+
-d "{
43+
'FileInfo': {
44+
'FilePath': 'SampleFiles/sample.docx'
45+
}
46+
}"
47+
48+
```
49+
50+
{{< /tab >}} {{< tab tabNum="2" >}}
51+
52+
```html
53+
54+
An empty response with status ‘204 No Content’ is returned to confirm deletion.
55+
56+
```
57+
58+
{{< /tab >}} {{< /tabs >}}
59+
60+
## SDKs ##
61+
62+
The API is completely independent of your operating system, database system or development language. We provide and support API SDKs in many development languages in order to make it even easier to integrate. You can see our available SDKs list [here](https://github.com/groupdocs-viewer-cloud).
63+
64+
### SDK Examples ###
65+
66+
{{< tabs tabTotal="7" tabID="10" tabName1="C#" tabName2="Java" tabName3="PHP" tabName4="Node.js" tabName5="Python" tabName6="Ruby" tabName7="Android" >}} {{< tab tabNum="1" >}}
67+
68+
```csharp
69+
70+
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-dotnet-samples
71+
string MyClientSecret = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
72+
string MyClientId = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
73+
74+
var configuration = new Configuration(MyClientId, MyClientSecret);
75+
var apiInstance = new ViewApi(configuration);
76+
77+
var viewOptions = new ViewOptions
78+
{
79+
FileInfo = new FileInfo
80+
{
81+
FilePath = "SampleFiles/sample.docx"
82+
}
83+
};
84+
85+
// Create view
86+
var response = apiInstance.CreateView(new CreateViewRequest(viewOptions));
87+
88+
// Delete view
89+
var deleteOptions = new DeleteViewOptions
90+
{
91+
FileInfo = new FileInfo
92+
{
93+
FilePath = "SampleFiles/sample.docx"
94+
}
95+
};
96+
97+
apiInstance.DeleteView(new DeleteViewRequest(deleteOptions));
98+
99+
```
100+
101+
{{< /tab >}} {{< tab tabNum="2" >}}
102+
103+
```java
104+
105+
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-java-samples
106+
string MyClientSecret = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
107+
string MyClientId = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
108+
109+
Configuration configuration = new Configuration(MyClientId, MyClientSecret);
110+
ViewApi apiInstance = new ViewApi(configuration);
111+
112+
FileInfo fileInfo = new FileInfo();
113+
fileInfo.setFilePath("SampleFiles/sample.docx");
114+
ViewOptions viewOptions = new ViewOptions();
115+
viewOptions.setFileInfo(fileInfo);
116+
117+
// Create view
118+
ViewResult response = apiInstance.createView(new CreateViewRequest(viewOptions));
119+
120+
// Delete view
121+
DeleteViewOptions deleteViewOptions = new DeleteViewOptions();
122+
fileInfo.setFilePath("SampleFiles/sample.docx");
123+
DeleteViewRequest dRequest = new DeleteViewRequest(deleteViewOptions);
124+
apiInstance.deleteView(dRequest);
125+
126+
```
127+
128+
{{< /tab >}} {{< tab tabNum="7" >}}
129+
130+
```java
131+
132+
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-java-samples
133+
string MyClientSecret = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
134+
string MyClientId = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
135+
136+
Configuration configuration = new Configuration(MyClientId, MyClientSecret);
137+
ViewApi apiInstance = new ViewApi(configuration);
138+
139+
FileInfo fileInfo = new FileInfo();
140+
fileInfo.setFilePath("SampleFiles/sample.docx");
141+
ViewOptions viewOptions = new ViewOptions();
142+
viewOptions.setFileInfo(fileInfo);
143+
144+
// Create view
145+
ViewResult response = apiInstance.createView(new CreateViewRequest(viewOptions));
146+
147+
// Delete view
148+
DeleteViewOptions deleteViewOptions = new DeleteViewOptions();
149+
fileInfo.setFilePath("SampleFiles/sample.docx");
150+
DeleteViewRequest dRequest = new DeleteViewRequest(deleteViewOptions);
151+
apiInstance.deleteView(dRequest);
152+
153+
```
154+
155+
{{< /tab >}} {{< tab tabNum="3" >}}
156+
157+
```php
158+
159+
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-php-samples
160+
use GroupDocs\Viewer\Model;
161+
use GroupDocs\Viewer\Model\Requests;
162+
163+
$ClientId = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
164+
$ClientSecret = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
165+
166+
$configuration = new GroupDocs\Viewer\Configuration();
167+
$configuration->setAppSid($ClientId);
168+
$configuration->setAppKey($ClientSecret);
169+
170+
$apiInstance = new GroupDocs\Viewer\ViewApi($configuration);
171+
172+
// Create view
173+
$viewOptions = new Model\ViewOptions();
174+
$fileInfo = new Model\FileInfo();
175+
$fileInfo->setFilePath("SampleFiles/sample.docx");
176+
$viewOptions->setFileInfo($fileInfo);
177+
178+
$request = new Requests\CreateViewRequest($viewOptions);
179+
$response = $apiInstance->createView($request);
180+
181+
// Delete view
182+
$deleteOptions = new DeleteViewOptions();
183+
$deleteOptions->setFileInfo($fileInfo);
184+
$deleteRequest = new Requests\deleteViewRequest($deleteOptions);
185+
186+
$apiInstance->deleteView($deleteRequest);
187+
```
188+
189+
{{< /tab >}} {{< tab tabNum="4" >}}
190+
191+
```javascript
192+
193+
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-node-samples
194+
global.viewer# require("groupdocs-viewer-cloud");
195+
196+
global.clientId = "XXXX-XXXX-XXXX-XXXX"; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
197+
global.clientSecret = "XXXXXXXXXXXXXXXX"; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
198+
199+
global.viewApi = viewer_cloud.ViewApi.fromKeys(clientId, clientSecret);
200+
201+
let fileInfo = new viewer_cloud.FileInfo();
202+
fileInfo.filePath = "SampleFiles/sample.docx";
203+
let viewOptions = new viewer_cloud.ViewOptions();
204+
viewOptions.fileInfo = fileInfo;
205+
206+
// Create view
207+
let request = new viewer_cloud.CreateViewRequest(viewOptions);
208+
let response = await viewApi.createView(request);
209+
210+
// Delete view
211+
let dvOptions = new DeleteViewOptions();
212+
dvOptions.fileInfo = fileInfo;
213+
const delRequest = new DeleteViewRequest(dvOptions);
214+
await viewApi.deleteView(delRequest);
215+
216+
```
217+
218+
{{< /tab >}} {{< tab tabNum="5" >}}
219+
220+
```python
221+
222+
# For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-python-samples
223+
import groupdocs_viewer_cloud
224+
225+
client_id = "XXXX-XXXX-XXXX-XXXX" # Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
226+
client_secret = "XXXXXXXXXXXXXXXX" # Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
227+
228+
apiInstance = groupdocs_viewer_cloud.ViewApi.from_keys(client_id, client_secret)
229+
230+
# Create view
231+
view_options = groupdocs_viewer_cloud.ViewOptions()
232+
view_options.file_info = groupdocs_viewer_cloud.FileInfo()
233+
view_options.file_info.file_path = "SampleFiles/sample.docx"
234+
235+
request = groupdocs_viewer_cloud.CreateViewRequest(view_options)
236+
response = apiInstance.create_view(request)
237+
238+
# Delete view
239+
d_view_options = groupdocs_viewer_cloud.DeleteViewOptions()
240+
d_view_options.file_info = view_options.file_info
241+
d_request = groupdocs_viewer_cloud.DeleteViewRequest(d_view_options)
242+
apiInstance.delete_view(d_request)
243+
244+
```
245+
246+
{{< /tab >}} {{< tab tabNum="6" >}}
247+
248+
```ruby
249+
250+
# For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-ruby-samples
251+
require 'groupdocs_viewer_cloud'
252+
253+
$client_id = "XXXX-XXXX-XXXX-XXXX" # Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
254+
$client_secret = "XXXXXXXXXXXXXXXX" # Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
255+
256+
apiInstance = GroupDocsViewerCloud::ViewApi.from_keys($client_id, $client_secret)
257+
258+
# Create view
259+
viewOptions = GroupDocsViewerCloud::ViewOptions.new
260+
viewOptions.file_info = GroupDocsViewerCloud::FileInfo.new
261+
viewOptions.file_info.file_path = "SampleFiles/sample.docx"
262+
263+
request = GroupDocsViewerCloud::CreateViewRequest.new(viewOptions)
264+
response = apiInstance.create_view(request)
265+
266+
# Delete view
267+
dViewOptions = GroupDocsViewerCloud::DeleteViewOptions.new
268+
dViewOptions.file_info = viewOptions.file_info
269+
dRequest = GroupDocsViewerCloud::DeleteViewRequest.new(dViewOptions)
270+
apiInstance.delete_view(dRequest)
271+
272+
```
273+
274+
{{< /tab >}} {{< /tabs >}}

content/viewer/developer-guide/basic-usage/render-document.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ There are steps that usage of GroupDocs.Viewer Cloud consists of:
2121
1. Upload input document into cloud storage
2222
1. Render document or get document info
2323
1. Download rendered document from storage
24+
1. Optional: [Delete]({{< ref "viewer/developer-guide/basic-usage/delete-rendered-document.md" >}}) rendered document from storage
2425

2526
Steps 1 and 3 are storage operations, please refer to this [File API documentation]({{< ref "viewer/developer-guide/working-with-files.md" >}}) for usage details.
2627

@@ -248,4 +249,3 @@ response = apiInstance.create_view(request)
248249
```
249250

250251
{{< /tab >}} {{< /tabs >}}
251-

docs-cloud-common

Submodule docs-cloud-common updated 45 files

0 commit comments

Comments
 (0)