Skip to content

confinitum/kpdfx

Repository files navigation

kpdfx

About The Project

This is a JavaFX PDF-Viewer Control written in Kotlin.

Product Name Screen Shot

It is based on PDFViewFX

Features

  • mouse zooming/panning (with Cmd/Alt)
  • viewport indicator in thumbnail
  • panning in thumbnail
  • page wise rotation (with thumbnail)

Built With

  • Java 11+
  • Kotlin
  • Gradle

(back to top)

Getting Started

Prerequisites

  • Java 11+
  • Kotlin 1.8+

This project builds with Java 11 but 15, 17, 19 also works.

Add dependency:

  • Maven
<dependency>
   <groupId>de.confinitum</groupId>
   <artifactId>kpdfx</artifactId>
   <version>1.0.0</version>
</dependency>
  • Gradle
implementation 'de.confinitum:kpdfx:1.0.0'

Code

Look at PdfViewController for basic idea how to use this control.

  • Kotlin
// create Control
val pdfView = PDFView().also {
   // tweak properties 
   it.setShowThumbnails(false)
   it.setThumbniailSize(150.0)
}
// add it to parent
somePane.children.add(pdfView)

// load pdf file
pdfView.load(file)
  • Java
PDFView pdfView=new PDFView();
        pdfView.setShowThumbnails(false);
        pdfView.setThumbnailSize(150.0);
// VBox.setVgrow(pdfView, Priority.ALWAYS);
        somePane.getChildren().add(pdfView);
        pdfView.load(file);

Installation / Running Demo Application

  1. Clone the repo
  2. Run the Demo App
gradlew clean run

(back to top)

License

Distributed under the Apache 2.0 License. See LICENSE for more information.

(back to top)