diff --git a/README.md b/README.md index 2619b05a2052d4b100d72fdb8c9dd83ff99ae2bd..dc84b6b5cfe0a6a9d1c2f9f26cf30fd05ef000b7 100644 --- a/README.md +++ b/README.md @@ -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