Skip to content

Commit 3431353

Browse files
Examples for SDK v20.3
1 parent b573849 commit 3431353

204 files changed

Lines changed: 2417 additions & 1409 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
*.class
2+
3+
# Mobile Tools for Java (J2ME)
4+
.mtj.tmp/
5+
6+
# Package Files #
7+
*.jar
8+
*.war
9+
*.ear
10+
11+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12+
hs_err_pid*
13+
14+
# build files
15+
**/target
16+
target
17+
build
18+
19+
.settings/
20+
.classpath
21+
.project
22+
.vscode/

Examples/.classpath

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,34 @@
1515
<attributes>
1616
<attribute name="optional" value="true"/>
1717
<attribute name="maven.pomderived" value="true"/>
18+
<attribute name="test" value="true"/>
1819
</attributes>
1920
</classpathentry>
20-
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
21+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
2122
<attributes>
2223
<attribute name="maven.pomderived" value="true"/>
2324
</attributes>
2425
</classpathentry>
25-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
26+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
2627
<attributes>
2728
<attribute name="maven.pomderived" value="true"/>
2829
</attributes>
2930
</classpathentry>
30-
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
31+
<classpathentry kind="src" path="target/generated-sources/annotations">
32+
<attributes>
33+
<attribute name="optional" value="true"/>
34+
<attribute name="maven.pomderived" value="true"/>
35+
<attribute name="ignore_optional_problems" value="true"/>
36+
<attribute name="m2e-apt" value="true"/>
37+
</attributes>
38+
</classpathentry>
39+
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
3140
<attributes>
41+
<attribute name="optional" value="true"/>
3242
<attribute name="maven.pomderived" value="true"/>
43+
<attribute name="ignore_optional_problems" value="true"/>
44+
<attribute name="m2e-apt" value="true"/>
45+
<attribute name="test" value="true"/>
3346
</attributes>
3447
</classpathentry>
3548
<classpathentry kind="output" path="target/classes"/>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
eclipse.preferences.version=1
22
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
33
org.eclipse.jdt.core.compiler.compliance=1.5
4+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
45
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7+
org.eclipse.jdt.core.compiler.processAnnotations=disabled
8+
org.eclipse.jdt.core.compiler.release=disabled
59
org.eclipse.jdt.core.compiler.source=1.5

Examples/README.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

Examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<dependency>
1515
<groupId>com.groupdocs</groupId>
1616
<artifactId>groupdocs-viewer-cloud</artifactId>
17-
<version>19.5</version>
17+
<version>20.3</version>
1818
<scope>compile</scope>
1919
</dependency>
2020
</dependencies>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package examples.AdvancedUsage.CommonRenderingOptions;
2+
3+
import com.groupdocs.cloud.viewer.client.*;
4+
import com.groupdocs.cloud.viewer.model.*;
5+
import com.groupdocs.cloud.viewer.model.ViewOptions.ViewFormatEnum;
6+
import com.groupdocs.cloud.viewer.model.requests.*;
7+
import com.groupdocs.cloud.viewer.api.*;
8+
import examples.Constants;
9+
10+
/**
11+
* This example demonstrates how to apply the watermark to the output pages
12+
*/
13+
public class AddWatermark {
14+
15+
public static void main(String[] args) {
16+
17+
ViewApi apiInstance = new ViewApi(Constants.GetConfiguration());
18+
try {
19+
20+
FileInfo fileInfo = new FileInfo();
21+
fileInfo.setFilePath("SampleFiles/sample.docx");
22+
ViewOptions viewOptions = new ViewOptions();
23+
viewOptions.setFileInfo(fileInfo);
24+
viewOptions.setViewFormat(ViewFormatEnum.HTML);
25+
Watermark watermark = new Watermark();
26+
watermark.setText("This is a watermark");
27+
viewOptions.setWatermark(watermark);
28+
29+
ViewResult response = apiInstance.createView(new CreateViewRequest(viewOptions));
30+
31+
System.out.println("AddWatermark completed: " + response.getPages().size());
32+
33+
} catch (ApiException e) {
34+
System.err.println("Exception: " + e.getMessage());
35+
e.printStackTrace();
36+
}
37+
}
38+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package examples.AdvancedUsage.CommonRenderingOptions;
2+
3+
import com.groupdocs.cloud.viewer.client.*;
4+
import com.groupdocs.cloud.viewer.model.*;
5+
import com.groupdocs.cloud.viewer.model.PageRotation.RotationAngleEnum;
6+
import com.groupdocs.cloud.viewer.model.ViewOptions.ViewFormatEnum;
7+
import com.groupdocs.cloud.viewer.model.requests.*;
8+
9+
import com.groupdocs.cloud.viewer.api.*;
10+
import examples.Constants;
11+
12+
/**
13+
* This example demonstrates how to rotate output pages when viewing a document as PDF
14+
*/
15+
public class FlipRotatePages {
16+
17+
public static void main(String[] args) {
18+
19+
ViewApi apiInstance = new ViewApi(Constants.GetConfiguration());
20+
try {
21+
22+
FileInfo fileInfo = new FileInfo();
23+
fileInfo.setFilePath("SampleFiles/sample.docx");
24+
ViewOptions viewOptions = new ViewOptions();
25+
viewOptions.setFileInfo(fileInfo);
26+
viewOptions.setViewFormat(ViewFormatEnum.PDF);
27+
RenderOptions renderOptions = new RenderOptions();
28+
PageRotation pageRotation = new PageRotation();
29+
pageRotation.setPageNumber(1);
30+
pageRotation.setRotationAngle(RotationAngleEnum.ON90DEGREE);
31+
renderOptions.addPageRotationsItem(pageRotation);
32+
viewOptions.setRenderOptions(renderOptions);
33+
34+
ViewResult response = apiInstance.createView(new CreateViewRequest(viewOptions));
35+
36+
System.out.println("FlipRotatePages completed: " + response.getFile().getPath());
37+
38+
} catch (ApiException e) {
39+
System.err.println("Exception: " + e.getMessage());
40+
e.printStackTrace();
41+
}
42+
}
43+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package examples.AdvancedUsage.CommonRenderingOptions;
2+
3+
import com.groupdocs.cloud.viewer.client.*;
4+
import com.groupdocs.cloud.viewer.model.*;
5+
import com.groupdocs.cloud.viewer.model.ViewOptions.ViewFormatEnum;
6+
import com.groupdocs.cloud.viewer.model.requests.*;
7+
8+
import com.groupdocs.cloud.viewer.api.*;
9+
import examples.Constants;
10+
11+
/**
12+
* This example demonstrates how to render documents with comments
13+
*/
14+
public class RenderComments {
15+
16+
public static void main(String[] args) {
17+
18+
ViewApi apiInstance = new ViewApi(Constants.GetConfiguration());
19+
try {
20+
21+
FileInfo fileInfo = new FileInfo();
22+
fileInfo.setFilePath("SampleFiles/with_comment.docx");
23+
ViewOptions viewOptions = new ViewOptions();
24+
viewOptions.setFileInfo(fileInfo);
25+
viewOptions.setViewFormat(ViewFormatEnum.HTML);
26+
RenderOptions renderOptions = new RenderOptions();
27+
renderOptions.setRenderComments(true);
28+
viewOptions.setRenderOptions(renderOptions);
29+
30+
ViewResult response = apiInstance.createView(new CreateViewRequest(viewOptions));
31+
32+
System.out.println("RenderComments completed: " + response.getPages().size());
33+
34+
} catch (ApiException e) {
35+
System.err.println("Exception: " + e.getMessage());
36+
e.printStackTrace();
37+
}
38+
}
39+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package examples.AdvancedUsage.CommonRenderingOptions;
2+
3+
import com.groupdocs.cloud.viewer.client.*;
4+
import com.groupdocs.cloud.viewer.model.*;
5+
import com.groupdocs.cloud.viewer.model.ViewOptions.ViewFormatEnum;
6+
import com.groupdocs.cloud.viewer.model.requests.*;
7+
8+
import com.groupdocs.cloud.viewer.api.*;
9+
import examples.Constants;
10+
11+
/**
12+
* This example demonstrates how to render consecutive pages
13+
*/
14+
public class RenderConsecutivePages {
15+
16+
public static void main(String[] args) {
17+
18+
ViewApi apiInstance = new ViewApi(Constants.GetConfiguration());
19+
try {
20+
21+
FileInfo fileInfo = new FileInfo();
22+
fileInfo.setFilePath("SampleFiles/sample.docx");
23+
ViewOptions viewOptions = new ViewOptions();
24+
viewOptions.setFileInfo(fileInfo);
25+
viewOptions.setViewFormat(ViewFormatEnum.HTML);
26+
RenderOptions renderOptions = new RenderOptions();
27+
renderOptions.setStartPageNumber(1);
28+
renderOptions.setCountPagesToRender(2);
29+
viewOptions.setRenderOptions(renderOptions);
30+
31+
ViewResult response = apiInstance.createView(new CreateViewRequest(viewOptions));
32+
33+
System.out.println("RenderConsecutivePages completed: " + response.getPages().size());
34+
35+
} catch (ApiException e) {
36+
System.err.println("Exception: " + e.getMessage());
37+
e.printStackTrace();
38+
}
39+
}
40+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package examples.AdvancedUsage.CommonRenderingOptions;
2+
3+
import com.groupdocs.cloud.viewer.client.*;
4+
import com.groupdocs.cloud.viewer.model.*;
5+
import com.groupdocs.cloud.viewer.model.ViewOptions.ViewFormatEnum;
6+
import com.groupdocs.cloud.viewer.model.requests.*;
7+
8+
import com.groupdocs.cloud.viewer.api.*;
9+
import examples.Constants;
10+
11+
/**
12+
* This example demonstrates how to render hidden page
13+
*/
14+
public class RenderHiddenPages {
15+
16+
public static void main(String[] args) {
17+
18+
ViewApi apiInstance = new ViewApi(Constants.GetConfiguration());
19+
try {
20+
21+
FileInfo fileInfo = new FileInfo();
22+
fileInfo.setFilePath("SampleFiles/with_hidden_page.pptx");
23+
ViewOptions viewOptions = new ViewOptions();
24+
viewOptions.setFileInfo(fileInfo);
25+
viewOptions.setViewFormat(ViewFormatEnum.HTML);
26+
RenderOptions renderOptions = new RenderOptions();
27+
renderOptions.setRenderHiddenPages(true);
28+
viewOptions.setRenderOptions(renderOptions);
29+
30+
ViewResult response = apiInstance.createView(new CreateViewRequest(viewOptions));
31+
32+
System.out.println("RenderHiddenPages completed: " + response.getPages().size());
33+
34+
} catch (ApiException e) {
35+
System.err.println("Exception: " + e.getMessage());
36+
e.printStackTrace();
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)