Skip to content
Snippets Groups Projects
Commit 6d525025 authored by Jari-Matti Mäkelä's avatar Jari-Matti Mäkelä
Browse files

Update README.md

parent ca010e23
Branches master
No related tags found
No related merge requests found
Pipeline #81607 passed
......@@ -56,7 +56,7 @@ Project dependency:
<dependency>
<groupId>fi.utu.tech</groupId>
<artifactId>pdfbox-wrapper</artifactId>
<version>1.1.0</version>
<version>1.2.3</version>
</dependency>
</dependencies>
```
......@@ -73,11 +73,20 @@ module demo {
## Example
```kotlin
import fi.utu.tech.pdfbox.document.*
import java.util.concurrent.ForkJoinPool
import javafx.application.Platform
import javafx.stage.Stage
import javafx.scene.Scene
import javafx.scene.image.ImageView
import javafx.scene.control.*
import javafx.scene.layout.*
val execThreads = 4
val executor = ForkJoinPool(execThreads)
val cacheSize = 10
val doc = PDFDocument(640, 360, "slides.pdf", executor)
val doc = PDFDocument(640, 360, FileSource("slides.pdf"), executor)
val cachedDoc = CachedDocument(doc, cacheSize)
// render first page (page 0)
......@@ -92,20 +101,17 @@ val page1_async_cached = cachedDoc.render(0)
// --
val gui = FlowPane()
gui.isFitToWidth = true
gui.vgap = 8.0
gui.hgap = 8.0
val stage = Stage()
stage.width = 1440
stage.height = 960
stage.width = 1440.0
stage.height = 960.0
stage.scene = Scene(ScrollPane(gui))
stage.show()
// --
gui.children.add(page1_sync)
page1_async.thenAccept {
val view = ImageView(it.image)
view.isPreserveRatio = true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment