Skip to content

Commit 1eea5e6

Browse files
#CONVERSIONJAVA-1932 Created an API usage example with the Ktor framework
1 parent e58a513 commit 1eea5e6

Some content is hidden

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

60 files changed

+136111
-0
lines changed

Demos/Ktor/.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
comparison-ktor/.gradle
2+
build/
3+
!gradle/wrapper/gradle-wrapper.jar
4+
!**/src/main/**/build/
5+
!**/src/test/**/build/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
bin/
16+
!**/src/main/**/bin/
17+
!**/src/test/**/bin/
18+
19+
### IntelliJ IDEA ###
20+
.idea
21+
*.iws
22+
*.iml
23+
*.ipr
24+
out/
25+
!**/src/main/**/out/
26+
!**/src/test/**/out/
27+
28+
### NetBeans ###
29+
/nbproject/private/
30+
/nbbuild/
31+
/dist/
32+
/nbdist/
33+
/.nb-gradle/
34+
35+
### VS Code ###
36+
.vscode/

Demos/Ktor/DocumentSamples/.gitkeep

Whitespace-only changes.

Demos/Ktor/DocumentSamples/ResultFiles/.gitkeep

Whitespace-only changes.

Demos/Ktor/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 GroupDocs.Conversion Product Family
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Demos/Ktor/Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: ./build/install/comparison-ktor/bin/comparison-ktor

Demos/Ktor/README.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
![GroupDocs.Conversion](https://raw.githubusercontent.com/groupdocs-Conversion/groupdocs-Conversion.github.io/master/resources/image/banner.png "GroupDocs.Conversion")
2+
# GroupDocs.Conversion for Java Ktor Example
3+
New GroupDocs.Conversion for Java Ktor UI Example
4+
###### version 23.5
5+
6+
[![GitHub license](https://img.shields.io/github/license/groupdocs-Conversion/GroupDocs.Conversion-for-Java-Spring.svg)](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java-Spring/blob/master/LICENSE)
7+
8+
## System Requirements
9+
- Java 11+ (JDK 11+)
10+
11+
12+
## Compare documents with Java API
13+
14+
**GroupDocs.Conversion for Java** is a library that allows you to **compare PDF, DOCX, PPT, XLS,** and over 90 other document formats. With GroupDocs.Conversion for Java you will be able to compare two or more files, perform style and text Conversion and generate a detailed report with changes.
15+
16+
This application allows you to compare multiple documents and can be used as a standalone application or integrated as part of your project.
17+
18+
**Note:** without a license application will run in trial mode, purchase [GroupDocs.Conversion for Java license](https://purchase.groupdocs.com/order-online-step-1-of-8.aspx) or request [GroupDocs.Conversion for Java temporary license](https://purchase.groupdocs.com/temporary-license).
19+
20+
21+
## Demo Video
22+
23+
<p align="center">
24+
<a title="Document Conversion for JAVA " href="https://www.youtube.com/watch?v=82RuvtV2qpw">
25+
<img src="https://raw.githubusercontent.com/groupdocs-Conversion/groupdocs-Conversion.github.io/master/resources/image/Conversion.gif" width="100%" style="width:100%;">
26+
</a>
27+
</p>
28+
29+
30+
## Features
31+
#### GroupDocs.Conversion
32+
- Clean, modern and intuitive design
33+
- Easily switchable colour theme (create your own colour theme in 5 minutes)
34+
- Responsive design
35+
- Mobile support (open application on any mobile device)
36+
- HTML and image modes
37+
- Fully customizable navigation panel
38+
- Compare documents
39+
- Multi-compare several documents
40+
- Compare password protected documents
41+
- Upload documents
42+
- Display clearly visible differences
43+
- Download Conversion results
44+
- Print Conversion results
45+
- Smooth document scrolling
46+
- Preload pages for faster document rendering
47+
- Multi-language support for displaying errors
48+
- Cross-browser support (Safari, Chrome, Opera, Firefox)
49+
- Cross-platform support (Windows, Linux, MacOS)
50+
51+
52+
## How to run
53+
54+
You can run this sample by one of following methods
55+
56+
57+
#### Run using IDE
58+
59+
Download [source code](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java/releases/download/v23.5/groupdocs-Conversion-ktor-23.5.0.zip) from github or clone this repository.
60+
61+
```bash
62+
git clone https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java.git
63+
cd GroupDocs.Conversion-for-Java/Demos/Ktor
64+
```
65+
Open project in IDE. Open `Application.kt` file and run `main` method inside it. Then open [http://localhost:8080/Conversion/](http://localhost:8080/Conversion/) in your favorite browser.
66+
67+
#### Run from command line
68+
69+
Download [source code](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java/archive/refs/heads/master.zip) from github.
70+
71+
Alternatively you can clone this repository using next command
72+
```bash
73+
git clone https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java.git
74+
```
75+
76+
Run sample from Windows PowerShell or Linux Terminal using next commands
77+
78+
```bash
79+
cd GroupDocs.Conversion-for-Java/Demos/Ktor
80+
.\gradlew.bat :run
81+
```
82+
83+
Open [http://localhost:8080/Conversion/](http://localhost:8080/Conversion/) in your favorite browser.
84+
85+
#### Build distribution archive
86+
87+
Download [source code](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java/archive/refs/heads/master.zip) from github.
88+
89+
Alternatively you can clone this repository using next command
90+
```bash
91+
git clone https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java.git
92+
```
93+
94+
Run sample from Windows PowerShell or Linux Terminal using next commands
95+
96+
```bash
97+
cd GroupDocs.Conversion-for-Java/Demos/Ktor
98+
.\gradlew.bat :build
99+
```
100+
101+
After that, go to `.\build\distributions\` directory to get distribution files.
102+
103+
#### Binary release (with all dependencies) for Linux
104+
105+
Download [latest release](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java/releases/latest) from [releases page](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java/releases).
106+
107+
**Note**: This method is **recommended** for running this sample behind firewall.
108+
109+
```bash
110+
curl -J -L -o release.tar.gz https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java/releases/download/v23.5/groupdocs-Conversion-ktor-23.5.0.tar
111+
tar -xvzf release.tar.gz
112+
cd release/Conversion-ktor-23.5
113+
## Make `bin/Conversion-ktor` file to be runnable
114+
bin/Conversion-ktor
115+
## Open http://localhost:8080/Conversion/ in your favorite browser.
116+
```
117+
118+
## Configuration
119+
You can adjust settings in `/src/main/resources/application.conf`. Specify relative/absolute path to license file by setting `licensePath` value in `/src/main/resources/application.conf` or by setting up `LIC_PATH` environment variable
120+
121+
### Conversion configuration options
122+
123+
| Option | Type | Default value | Description |
124+
|------------------------| ------- |:---------------------:|:---------------------------------------------------------------------------------------------------------------------|
125+
| **`filesDirectory`** | String | `DocumentSamples` | Files directory path. Indicates where uploaded and predefined files are stored. It can be absolute or relative path |
126+
| **`tempDirectory`** | String | system temp directory | Absolute or relative path to directory to save temporary files |
127+
| **`resultDirectory`** | String | `ResultFiles` | Result files directory path. Directory must be created before app starts |
128+
129+
## License
130+
The MIT License (MIT).
131+
132+
Please have a look at the LICENSE.md for more details
133+
134+
## GroupDocs Conversion on other platforms & frameworks
135+
136+
- [Compare documents](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java/tree/master/Demos/Compose) with Kotlin in Compose Desktop application
137+
- [Compare documents](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java/tree/master/Demos/Dropwizard) with JAVA Dropwizard
138+
- [Compare documents](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java/tree/master/Demos/Javalin) with Javalin application
139+
- [Compare documents](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java/tree/master/Demos/Spring) with Spring application
140+
- [Compare documents](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-.NET-MVC) with .NET MVC
141+
- [Compare documents](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-.NET-WebForms) with .NET WebForms
142+
143+
144+
[Home](https://www.groupdocs.com/) | [Product Page](https://products.groupdocs.com/Conversion/java) | [Documentation](https://docs.groupdocs.com/Conversion/java/) | [Demos](https://products.groupdocs.app/Conversion/family) | [API Reference](https://apireference.groupdocs.com/java/Conversion) | [Examples](https://github.com/groupdocs-Conversion/GroupDocs.Conversion-for-Java/tree/master/Examples) | [Blog](https://blog.groupdocs.com/category/Conversion/) | [Free Support](https://forum.groupdocs.com/c/Conversion) | [Temporary License](https://purchase.groupdocs.com/temporary-license)

Demos/Ktor/build.gradle.kts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
val ktor_version: String by project
2+
val kotlin_version: String by project
3+
val koin_version: String by project
4+
val logback_version: String by project
5+
6+
plugins {
7+
application
8+
kotlin("jvm") version "1.6.21"
9+
id("org.jetbrains.kotlin.plugin.serialization") version "1.6.21"
10+
}
11+
12+
group = "com.groupdocs.ui.conversion.ktor"
13+
version = "23.6"
14+
15+
repositories {
16+
mavenLocal()
17+
mavenCentral()
18+
maven("https://releases.groupdocs.com/java/repo")
19+
}
20+
21+
application {
22+
mainClass.set("com.groupdocs.ui.conversion.ktor.ApplicationKt")
23+
24+
val isDevelopment: Boolean = project.ext.has("development")
25+
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
26+
}
27+
28+
tasks {
29+
create("stage").dependsOn("installDist")
30+
}
31+
32+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
33+
kotlinOptions.jvmTarget = "11"
34+
}
35+
36+
kotlin {
37+
jvmToolchain {
38+
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(11))
39+
}
40+
}
41+
42+
dependencies {
43+
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
44+
45+
implementation("com.groupdocs:groupdocs-conversion:$version")
46+
47+
implementation("io.insert-koin:koin-ktor:$koin_version")
48+
49+
implementation("io.ktor:ktor-server-core:$ktor_version")
50+
implementation("io.ktor:ktor-server-sessions:$ktor_version")
51+
implementation("io.ktor:ktor-server-status-pages:$ktor_version")
52+
implementation("io.ktor:ktor-server-host-common:$ktor_version")
53+
implementation("io.ktor:ktor-server-default-headers:$ktor_version")
54+
implementation("io.ktor:ktor-server-call-logging:$ktor_version")
55+
implementation("io.ktor:ktor-server-metrics:$ktor_version")
56+
implementation("io.ktor:ktor-server-content-negotiation:$ktor_version")
57+
implementation("io.ktor:ktor-serialization-gson:$ktor_version")
58+
implementation("io.ktor:ktor-server-netty:$ktor_version")
59+
60+
implementation("io.ktor:ktor-server-html-builder:$ktor_version")
61+
62+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.3.3")
63+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-hocon:1.3.3")
64+
65+
implementation("commons-io:commons-io:2.7")
66+
67+
implementation("ch.qos.logback:logback-classic:$logback_version")
68+
testImplementation("io.ktor:ktor-server-tests:$ktor_version")
69+
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
70+
}

Demos/Ktor/gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ktor_version=2.0.1
2+
kotlin_version=1.6.21
3+
koin_version=3.2.0
4+
logback_version=1.2.11
5+
kotlin.code.style=official
58.4 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)