@@ -5,15 +5,14 @@ title: "Add watermark"
55productName : " GroupDocs.Viewer Cloud"
66description : " "
77keywords : " "
8+ toc : True
89---
910
10- # Introduction #
11-
1211GroupDocs.Viewer Cloud enables you to apply a watermark on the output pages (HTML / Image / PDF).
1312
1413The following code sample shows how to apply the watermark to the output pages.
1514
16- ## API Usage ##
15+ ## API Usage
1716
1817There are steps that usage of GroupDocs.Viewer Cloud consists of:
1918
@@ -25,21 +24,20 @@ Steps 1 and 3 are storage operations, please refer to this [File API document
2524
2625[ Swagger UI] ( https://apireference.groupdocs.cloud/viewer/ ) lets you call this REST API directly from the browser.
2726
28- ## cURL REST Example ##
29-
30- {{< tabs tabTotal="2" tabID="1" tabName1="Request" tabName2="Response" >}} {{< tab tabNum="1" >}}
27+ ## cURL example
3128
32- ``` html
33-
34- * First get JSON Web Token
35- * 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.
29+ {{< tabs "example1">}}
30+ {{< tab "Request" >}}
31+ ``` bash
32+ # First get JSON Web Token
33+ # 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.
3634curl -v " https://api.groupdocs.cloud/connect/token" \
3735-X POST \
3836-d " grant_type=client_credentials&client_id=xxxx&client_secret=xxxx" \
3937-H " Content-Type: application/x-www-form-urlencoded" \
4038-H " Accept: application/json"
4139
42- * cURL example to get document information
40+ # cURL example to get document information
4341curl -v " https://api.groupdocs.cloud/v2.0/viewer/view" \
4442-X POST \
4543-H " Content-Type: application/json" \
@@ -54,13 +52,9 @@ curl -v "https://api.groupdocs.cloud/v2.0/viewer/view" \
5452 'Text': 'This is a watermark'
5553 }
5654}"
57-
5855```
59-
60- {{< /tab >}} {{< tab tabNum="2" >}}
61-
62- ``` html
63-
56+ {{< /tab >}} {{< tab "Resonse" >}}
57+ ``` json
6458{
6559 "pages" : [
6660 {
@@ -87,19 +81,15 @@ curl -v "https://api.groupdocs.cloud/v2.0/viewer/view" \
8781}
8882
8983```
90-
9184{{< /tab >}} {{< /tabs >}}
9285
93- ## SDKs ##
86+ ## SDK examples
9487
9588The 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 ) .
9689
97- ### SDK Examples ###
98-
99- {{< tabs tabTotal="7" tabID="10" tabName1="C#" tabName2="Java" tabName3="PHP" tabName4="Node.js" tabName5="Python" tabName6="Ruby" tabName7="Android" >}} {{< tab tabNum="1" >}}
100-
101- ``` csharp
102-
90+ {{< tabs "example1-sdk">}}
91+ {{< tab "C#" >}}
92+ ``` cs
10393// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-dotnet-samples
10494string MyClientSecret = " " ; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
10595string MyClientId = " " ; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
@@ -122,61 +112,10 @@ var viewOptions = new ViewOptions
122112};
123113
124114var response = apiInstance .CreateView (new CreateViewRequest (viewOptions ));
125-
126115```
127-
128- {{< /tab >}} {{< tab tabNum="2" >}}
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- viewOptions. setViewFormat(ViewFormatEnum . HTML );
144- Watermark watermark = new Watermark ();
145- watermark. setText(" This is a watermark" );
146- viewOptions. setWatermark(watermark);
147-
148- ViewResult response = apiInstance. createView(new CreateViewRequest (viewOptions));
149-
150- ```
151-
152- {{< /tab >}} {{< tab tabNum="7" >}}
153-
154- ``` java
155-
156- // For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-java-samples
157- string MyClientSecret = " " ; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
158- string MyClientId = " " ; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
159-
160- Configuration configuration = new Configuration (MyClientId , MyClientSecret );
161- ViewApi apiInstance = new ViewApi (configuration);
162-
163- FileInfo fileInfo = new FileInfo ();
164- fileInfo. setFilePath(" SampleFiles/sample.docx" );
165- ViewOptions viewOptions = new ViewOptions ();
166- viewOptions. setFileInfo(fileInfo);
167- viewOptions. setViewFormat(ViewFormatEnum . HTML );
168- Watermark watermark = new Watermark ();
169- watermark. setText(" This is a watermark" );
170- viewOptions. setWatermark(watermark);
171-
172- ViewResult response = apiInstance. createView(new CreateViewRequest (viewOptions));
173-
174- ```
175-
176- {{< /tab >}} {{< tab tabNum="3" >}}
177-
116+ {{< /tab >}}
117+ {{< tab "PHP">}}
178118``` php
179-
180119// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-php-samples
181120use GroupDocs\Viewer\Model;
182121use GroupDocs\Viewer\Model\Requests;
@@ -201,13 +140,52 @@ $viewOptions->setWatermark($watermark);
201140
202141$request = new Requests\CreateViewRequest($viewOptions);
203142$response = $apiInstance->createView($request);
143+ ```
144+ {{< /tab >}}
145+ {{< tab "Java">}}
146+ ``` java
147+ // For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-java-samples
148+ string MyClientSecret = " " ; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
149+ string MyClientId = " " ; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
150+
151+ Configuration configuration = new Configuration (MyClientId , MyClientSecret );
152+ ViewApi apiInstance = new ViewApi (configuration);
153+
154+ FileInfo fileInfo = new FileInfo ();
155+ fileInfo. setFilePath(" SampleFiles/sample.docx" );
156+ ViewOptions viewOptions = new ViewOptions ();
157+ viewOptions. setFileInfo(fileInfo);
158+ viewOptions. setViewFormat(ViewFormatEnum . HTML );
159+ Watermark watermark = new Watermark ();
160+ watermark. setText(" This is a watermark" );
161+ viewOptions. setWatermark(watermark);
204162
163+ ViewResult response = apiInstance. createView(new CreateViewRequest (viewOptions));
205164```
165+ {{< /tab >}}
166+ {{< tab "Ruby">}}
167+ ``` ruby
168+ # For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-ruby-samples
169+ require ' groupdocs_viewer_cloud'
206170
207- {{< /tab >}} {{< tab tabNum="4" >}}
171+ $client_id = " XXXX-XXXX-XXXX-XXXX" # Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
172+ $client_secret = " XXXXXXXXXXXXXXXX" # Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
208173
209- ``` javascript
174+ apiInstance = GroupDocsViewerCloud :: ViewApi .from_keys( $client_id , $client_secret )
210175
176+ viewOptions = GroupDocsViewerCloud ::ViewOptions .new
177+ viewOptions.file_info = GroupDocsViewerCloud ::FileInfo .new
178+ viewOptions.file_info.file_path = " SampleFiles/sample.docx"
179+ viewOptions.view_format = " HTML"
180+ viewOptions.watermark = GroupDocsViewerCloud ::Watermark .new
181+ viewOptions.watermark.text = " This is a watermark"
182+
183+ request = GroupDocsViewerCloud ::CreateViewRequest .new (viewOptions)
184+ response = apiInstance.create_view(request)
185+ ```
186+ {{< /tab >}}
187+ {{< tab "Node.js">}}
188+ ``` js
211189// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-node-samples
212190global .viewer # require (" groupdocs-viewer-cloud" );
213191
@@ -226,13 +204,10 @@ viewOptions.watermark.text = "This is a watermark";
226204
227205let request = new viewer_cloud.CreateViewRequest (viewOptions);
228206let response = await viewApi .createView (request);
229-
230207```
231-
232- {{< /tab >}} {{< tab tabNum="5" >}}
233-
234- ``` python
235-
208+ {{< /tab >}}
209+ {{< tab "Python">}}
210+ ``` py
236211# For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-python-samples
237212import groupdocs_viewer_cloud
238213
@@ -252,30 +227,5 @@ request = groupdocs_viewer_cloud.CreateViewRequest(view_options)
252227response = apiInstance.create_view(request)
253228
254229```
255-
256- {{< /tab >}} {{< tab tabNum="6" >}}
257-
258- ``` ruby
259-
260- # For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-ruby-samples
261- require ' groupdocs_viewer_cloud'
262-
263- $client_id = " XXXX-XXXX-XXXX-XXXX" # Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
264- $client_secret = " XXXXXXXXXXXXXXXX" # Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
265-
266- apiInstance = GroupDocsViewerCloud ::ViewApi .from_keys($client_id , $client_secret )
267-
268- viewOptions = GroupDocsViewerCloud ::ViewOptions .new
269- viewOptions.file_info = GroupDocsViewerCloud ::FileInfo .new
270- viewOptions.file_info.file_path = " SampleFiles/sample.docx"
271- viewOptions.view_format = " HTML"
272- viewOptions.watermark = GroupDocsViewerCloud ::Watermark .new
273- viewOptions.watermark.text = " This is a watermark"
274-
275- request = GroupDocsViewerCloud ::CreateViewRequest .new (viewOptions)
276- response = apiInstance.create_view(request)
277-
278- ```
279-
280- {{< /tab >}} {{< /tabs >}}
281-
230+ {{< /tab >}}
231+ {{< /tabs >}}
0 commit comments