Class PdfGenerator
- java.lang.Object
-
- com.palmer.billingstatementgenerator.pdf.PdfGenerator
-
public final class PdfGenerator extends java.lang.ObjectGenerates PDF billing statements from aStatementusing a JasperReports template. The compiled report is cached after the first call togenerate(com.palmer.billingstatementgenerator.models.statement.Statement, java.io.File). Useexport(javafx.stage.Window)to open a save dialog and write the PDF for the current statement.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidexport(javafx.stage.Window ownerWindow)Opens a save dialog and exports the current statement as a PDF.static voidgenerate(Statement stmt, java.io.File outputFile)Fills the Jasper report template from the given statement and writes the result to the specified file.
-
-
-
Method Detail
-
generate
public static void generate(Statement stmt, java.io.File outputFile) throws java.io.IOException
Fills the Jasper report template from the given statement and writes the result to the specified file.- Parameters:
stmt- the statement to exportoutputFile- the destination file to write the PDF to- Throws:
java.io.IOException- if the template cannot be loaded or PDF generation fails
-
export
public static void export(javafx.stage.Window ownerWindow)
Opens a save dialog and exports the current statement as a PDF. Shows a success or error alert when the operation completes.- Parameters:
ownerWindow- the owner window for the save dialog and any alerts shown
-
-