0

Is there a way to print/export a collection of Panes containing Nodes to a PDF file in JavaFX? Each Pane represents an A4 page and contains Text and Webview elements as in the following image:

Pane with Text and Webview elements

The only workaround solution I found (with reference to this blogpost) was to print the Pane Nodes using the JavaFX API and selecting a PDF printer such as CutePDF. The goal is to directly provide the ability to produce a PDF file directly without relying on an external PDF printer.

TM00
  • 1,330
  • 1
  • 14
  • 26
  • 1
    You could take a snapshot then use a PDF api to add the image to PDF. You could also use a PDF api to add the text to a PDF. – SedJ601 Oct 11 '18 at 21:14
  • https://stackoverflow.com/questions/16293859/print-a-pdf-file-using-printerjob-in-java [Apache PDFBox](https://pdfbox.apache.org/) or [iText](https://developers.itextpdf.com/itext7/download-and-install-information/Java). – SedJ601 Oct 11 '18 at 21:17
  • @Sedrick Thanks! I stumbled across [OpenPDF](https://github.com/LibrePDF/OpenPDF) to assist in creating the PDF. – TM00 Oct 23 '18 at 20:09

0 Answers0