Skip to content

Commit f40e1c2

Browse files
authored
Merge pull request #1 from rizwanniazigroupdocs/master
Updated Java Viewer Cloud SDK Examples
2 parents 497f1f0 + 190f5b3 commit f40e1c2

112 files changed

Lines changed: 47339 additions & 2 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: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Eclipse project files
2+
.classpath
3+
.project
4+
.settings/
5+
test-output/
6+
7+
# IntelliJ project files
8+
.idea/
9+
*.iws
10+
*.iml
11+
*.ipr
12+
13+
# Mac
14+
.DS_Store
15+
16+
# Others
17+
Temp/
18+
obj/
19+
classes/
20+
generated/
21+
bin/
22+
*_out_*
23+
* Out*
24+
* out*
25+
*.ldb
26+
_ReSharper*/
27+
*.eml
28+
out/
29+
*.user
30+
*.resx
31+
nbproject/
32+
target/
33+
build/
34+
build.xml
35+
Thumbs.db
36+
manifest.mf
37+
Out/
38+
Out*/
39+
*.lic
40+
Data/*Out*
41+
/dist/

Examples/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.idea/
2+
target/
3+
*.iml
4+
~*
5+
*.*~
6+
*[Oo]ut*

Examples/.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>viewer-java-examples</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>

Examples/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
GroupDocs.Viewer Cloud SDK for Java Examples
2+
3+
This directory contains Java examples for [GroupDocs.Viewer Cloud SDK for Java](https://products.groupdocs.cloud/viewer/java).
4+
5+
How to use the Examples?
6+
7+
Clone or Download the ZIP and extract the contents to your local hard drive. This project uses Maven build system and can be opened in any modern IDE like IntelliJ IDEA, Eclipse or NetBeans. For more details, visit our [Documentation website](https://docs.groupdocs.cloud/display/viewercloud/Home).

Examples/pom.xml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.groupdocs</groupId>
8+
<artifactId>viewer-java-examples</artifactId>
9+
<version>1.0</version>
10+
<build>
11+
<plugins>
12+
<plugin>
13+
<groupId>org.apache.maven.plugins</groupId>
14+
<artifactId>maven-enforcer-plugin</artifactId>
15+
<version>3.0.0-M1</version>
16+
<executions>
17+
<execution>
18+
<id>enforce-maven</id>
19+
<goals>
20+
<goal>enforce</goal>
21+
</goals>
22+
<configuration>
23+
<rules>
24+
<requireMavenVersion>
25+
<version>2.2.0</version>
26+
</requireMavenVersion>
27+
</rules>
28+
</configuration>
29+
</execution>
30+
</executions>
31+
</plugin>
32+
<plugin>
33+
<groupId>org.apache.maven.plugins</groupId>
34+
<artifactId>maven-surefire-plugin</artifactId>
35+
<version>2.12</version>
36+
<configuration>
37+
<systemProperties>
38+
<property>
39+
<name>loggerPath</name>
40+
<value>conf/log4j.properties</value>
41+
</property>
42+
</systemProperties>
43+
<argLine>-Xms512m -Xmx1500m</argLine>
44+
<parallel>methods</parallel>
45+
<forkMode>pertest</forkMode>
46+
</configuration>
47+
</plugin>
48+
<plugin>
49+
<artifactId>maven-dependency-plugin</artifactId>
50+
<executions>
51+
<execution>
52+
<phase>package</phase>
53+
<goals>
54+
<goal>copy-dependencies</goal>
55+
</goals>
56+
<configuration>
57+
<outputDirectory>${project.build.directory}/lib</outputDirectory>
58+
</configuration>
59+
</execution>
60+
</executions>
61+
</plugin>
62+
<plugin>
63+
<groupId>org.apache.maven.plugins</groupId>
64+
<artifactId>maven-javadoc-plugin</artifactId>
65+
<version>2.10.4</version>
66+
<executions>
67+
<execution>
68+
<id>attach-javadocs</id>
69+
<goals>
70+
<goal>jar</goal>
71+
</goals>
72+
</execution>
73+
</executions>
74+
</plugin>
75+
<plugin>
76+
<groupId>org.apache.maven.plugins</groupId>
77+
<artifactId>maven-source-plugin</artifactId>
78+
<version>2.2.1</version>
79+
<executions>
80+
<execution>
81+
<id>attach-sources</id>
82+
<goals>
83+
<goal>jar-no-fork</goal>
84+
</goals>
85+
</execution>
86+
</executions>
87+
</plugin>
88+
</plugins>
89+
</build>
90+
91+
<repositories>
92+
<repository>
93+
<id>GroupDocsJavaCloudAPI</id>
94+
<name>GroupDocs Java Cloud API</name>
95+
<url>http://artifact.groupdocs.cloud/repo/</url>
96+
</repository>
97+
<repository>
98+
<id>maven.aspose.cloud</id>
99+
<name>maven.aspose.cloud</name>
100+
<url>http://artifact.aspose.cloud/repo/</url>
101+
</repository>
102+
</repositories>
103+
104+
<dependencies>
105+
<dependency>
106+
<groupId>com.groupdocs</groupId>
107+
<artifactId>groupdocs-viewer-cloud</artifactId>
108+
<version>18.7</version>
109+
</dependency>
110+
<dependency>
111+
<groupId>io.swagger</groupId>
112+
<artifactId>swagger-annotations</artifactId>
113+
<version>${swagger-core-version}</version>
114+
</dependency>
115+
<dependency>
116+
<groupId>com.squareup.okhttp</groupId>
117+
<artifactId>okhttp</artifactId>
118+
<version>${okhttp-version}</version>
119+
</dependency>
120+
<dependency>
121+
<groupId>com.squareup.okhttp</groupId>
122+
<artifactId>logging-interceptor</artifactId>
123+
<version>${okhttp-version}</version>
124+
</dependency>
125+
<dependency>
126+
<groupId>com.google.code.gson</groupId>
127+
<artifactId>gson</artifactId>
128+
<version>${gson-version}</version>
129+
</dependency>
130+
<dependency>
131+
<groupId>io.gsonfire</groupId>
132+
<artifactId>gson-fire</artifactId>
133+
<version>${gson-fire-version}</version>
134+
</dependency>
135+
<dependency>
136+
<groupId>org.threeten</groupId>
137+
<artifactId>threetenbp</artifactId>
138+
<version>${threetenbp-version}</version>
139+
</dependency>
140+
<!-- test dependencies -->
141+
<dependency>
142+
<groupId>junit</groupId>
143+
<artifactId>junit</artifactId>
144+
<version>${junit-version}</version>
145+
</dependency>
146+
<dependency>
147+
<groupId>com.aspose</groupId>
148+
<artifactId>aspose-cloud-storage</artifactId>
149+
<version>${aspose-cloud-storage-version}</version>
150+
</dependency>
151+
</dependencies>
152+
<properties>
153+
<java.version>1.7</java.version>
154+
<maven.compiler.source>${java.version}</maven.compiler.source>
155+
<maven.compiler.target>${java.version}</maven.compiler.target>
156+
<gson-fire-version>1.8.0</gson-fire-version>
157+
<swagger-core-version>1.5.15</swagger-core-version>
158+
<okhttp-version>2.7.5</okhttp-version>
159+
<gson-version>2.8.1</gson-version>
160+
<threetenbp-version>1.3.5</threetenbp-version>
161+
<maven-plugin-version>1.0.0</maven-plugin-version>
162+
<junit-version>4.12</junit-version>
163+
<aspose-cloud-storage-version>1.0.0</aspose-cloud-storage-version>
164+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
165+
</properties>
166+
</project>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.groupdocs.cloud.viewer.examples.Document_Information;
2+
3+
import com.groupdocs.cloud.viewer.client.*;
4+
import com.groupdocs.cloud.viewer.model.*;
5+
import com.groupdocs.cloud.viewer.model.requests.HtmlCreatePagesCacheRequest;
6+
import com.groupdocs.cloud.viewer.examples.Utils;
7+
import com.groupdocs.cloud.viewer.api.ViewerApi;
8+
import java.util.*;
9+
10+
public class Create_CAD_Layers_Cache_HTML {
11+
12+
public static void main(String[] args) {
13+
14+
ViewerApi apiInstance = Utils.getViewerAPIInstance();
15+
try {
16+
HtmlCreatePagesCacheRequest request = new HtmlCreatePagesCacheRequest();
17+
request.setFileName("sample.DXF");
18+
19+
HtmlOptions htmlOptions = new HtmlOptions();
20+
htmlOptions.setAttachmentPassword("");
21+
htmlOptions.setEmbedResources(true);
22+
23+
CadOptions cadOptions = new CadOptions();
24+
List<String> lstLayers = new ArrayList<String>();
25+
lstLayers.add("SLD-0");
26+
lstLayers.add("DEFAULT_3");
27+
28+
cadOptions.setLayers(lstLayers);
29+
request.setHtmlOptions(htmlOptions);
30+
request.setFolder("");
31+
request.setStorage("MyStorage");
32+
33+
HtmlPageCollection response = apiInstance.htmlCreatePagesCache(request);
34+
35+
System.out.println("Cache Created");
36+
System.out.println("Pages Count: " + response.getPages().size());
37+
System.out.println("File Name: " + response.getFileName());
38+
39+
System.out.println("Executed Successfully");
40+
} catch (ApiException e) {
41+
System.err.println("Exception when calling ViewerApi");
42+
e.printStackTrace();
43+
}
44+
}
45+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.groupdocs.cloud.viewer.examples.Document_Information;
2+
3+
import com.groupdocs.cloud.viewer.client.*;
4+
import com.groupdocs.cloud.viewer.model.*;
5+
import com.groupdocs.cloud.viewer.model.requests.ImageCreatePagesCacheRequest;
6+
import com.groupdocs.cloud.viewer.examples.Utils;
7+
import com.groupdocs.cloud.viewer.api.ViewerApi;
8+
import java.util.*;
9+
10+
public class Create_CAD_Layers_Cache_Image {
11+
12+
public static void main(String[] args) {
13+
14+
ViewerApi apiInstance = Utils.getViewerAPIInstance();
15+
try {
16+
ImageCreatePagesCacheRequest request = new ImageCreatePagesCacheRequest();
17+
request.setFileName("sample.DXF");
18+
19+
CadOptions cadOptions = new CadOptions();
20+
List<String> lstLayers = new ArrayList<String>();
21+
lstLayers.add("SLD-0");
22+
lstLayers.add("DEFAULT_3");
23+
24+
cadOptions.setLayers(lstLayers);
25+
request.setFolder("");
26+
request.setStorage("MyStorage");
27+
28+
ImagePageCollection response = apiInstance.imageCreatePagesCache(request);
29+
30+
System.out.println("Cache Created");
31+
System.out.println("Pages Count: " + response.getPages().size());
32+
System.out.println("File Name: " + response.getFileName());
33+
34+
System.out.println("Executed Successfully");
35+
} catch (ApiException e) {
36+
System.err.println("Exception when calling ViewerApi");
37+
e.printStackTrace();
38+
}
39+
}
40+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.groupdocs.cloud.viewer.examples.Document_Information;
2+
3+
import com.groupdocs.cloud.viewer.client.*;
4+
import com.groupdocs.cloud.viewer.model.*;
5+
import com.groupdocs.cloud.viewer.model.requests.HtmlGetDocumentInfoRequest;
6+
import com.groupdocs.cloud.viewer.examples.Utils;
7+
import com.groupdocs.cloud.viewer.api.ViewerApi;
8+
9+
public class Get_CAD_DocumentInfo_Html {
10+
11+
public static void main(String[] args) {
12+
13+
ViewerApi apiInstance = Utils.getViewerAPIInstance();
14+
try {
15+
HtmlGetDocumentInfoRequest request = new HtmlGetDocumentInfoRequest();
16+
request.setFileName("sample.DXF");
17+
request.setPassword("");
18+
request.setRenderComments(false);
19+
request.setRenderHiddenPages(true);
20+
request.setFolder(null);
21+
request.setStorage("MyStorage");
22+
23+
DocumentInfo response = apiInstance.htmlGetDocumentInfo(request);
24+
25+
System.out.println("Layers Count: " + response.getLayers().size());
26+
System.out.println("File Name: " + response.getFileName());
27+
28+
System.out.println("Executed Successfully");
29+
} catch (ApiException e) {
30+
System.err.println("Exception when calling ViewerApi");
31+
e.printStackTrace();
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)