Gramero
Gramero

Reputation: 1885

How do I use Java fx pdf viewer?

Does anyone have a recommended way to view a PDF file by using javafx?

Upvotes: 2

Views: 8150

Answers (4)

Jino
Jino

Reputation: 13

The following thread from stackoverflow.com discusses different possibility to develop a pdf viewer for the javafx application. Displaying pdf in JavaFX

The following libraries can be tried for this implementation:

OpenViewerFX – An Open Source JavaFX PDF Viewer: https://www.idrsolutions.com/openviewerfx/
PDF renderer with Java: https://java.net/projects/pdf-renderer
PDF.js
JPedalFX
SwingLabs

Upvotes: 1

jewelsea
jewelsea

Reputation: 159566

Try the JPedalFX viewer which provides a JavaFX component for viewing PDF files.

OR

Pre-convert the PDF into JavaFX code prior to viewing using the JPedal PDF to JavaFX converter.

Upvotes: 5

Perneel
Perneel

Reputation: 3367

Don't know if this is what you are looking for, this line just opens pdf files in the OS (so not embedded or anything, you'll need a program installed that can handle pdf's like Adobe Reader):

Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + file.getAbsolutePath());

Upvotes: 1

duffymo
duffymo

Reputation: 309008

Two separate issues: PDF and display.

Java FX is your display.

You can generate PDFs using XSL-FO if you have XML to start with and like writing stylesheets, OR you can do it with Java code if you use the iText library.

Upvotes: 1

Related Questions