> On 19 Jul 2016, at 05:34, Gstöttner Siegfried 
> <[email protected]> wrote:
> 
> Hi!
> 
> I am pretty new to java and currently working on an application for printing 
> serial letters in JavaFX. I would like to give the user an overview of the 
> result in a simple pdf-viewer. Like that one shown in an example prior to 
> ver2.0. Could anybody tell me how to implement this with the actual libry? 
> Examples missing or i could not find them. Are there any experiences with 
> usage of Java FX8 Swingnode class to display such a viewer? Thank you very 
> much.

Assuming you already have a PDDocument, and a Label named “pageView”, you can 
render individual pages into the Label as follows:

PDFRenderer renderer = new PDFRenderer(doc);
BufferedImage bufImage = renderer.renderImage(0);
Image image = SwingFXUtils.toFXImage(bufImage, null);
pageView.setGraphic(new ImageView(image));

I’d recommend taking this approach and letting JavaFX handle any scrolling of 
the Label. You can then have multiple labels for multiple pages, or a single 
label and next/prev page buttons.

— John

> Kind regards,
> Siegfried
> -
> Siegfried Gstöttner
> [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to