Package ca.cgjennings.apps.arkham.deck
Class PDFPrintSupport
- java.lang.Object
-
- ca.cgjennings.apps.arkham.deck.PDFPrintSupport
-
public final class PDFPrintSupport extends java.lang.ObjectCreates simple PDF documents. PDF support is not built in; to use this class thecore-PDFOutput.selibrarylibrary must be installed. (That library provides a concrete implementation of thePDFPrintSupport.PDFWriterinterface defined in this class.) You can test whether PDF support is available by callingisAvailable().For easy PDF creation, use one of the static
printToPDFmethods that take aPrintableorDeckEditor. Alternatively, callcreatePDFWriter()to obtain a high-level interface to the PDF engine.- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPDFPrintSupport.ConfigurationThis class is a simple container for the configuration information that is passed to aPDFPrintSupport.PDFWriter.static interfacePDFPrintSupport.PDFWriterAn interface implemented by classes that can provide very basic PDF writing support.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PDFPrintSupport.PDFWritercreatePDFWriter()Returns a new instance of aPDFPrintSupport.PDFWriter.static floatgetDefaultOutputQuality()Returns the default output quality level for newPDFPrintSupport.Configurations.static java.lang.StringgetImplementationClassName()Returns the name of the concretePDFPrintSupport.PDFWriterclass to use.static booleanisAvailable()Returnstrueif PDF support is available.static voidprintToPDF(DeckEditor deckEditor, java.io.File pdfFile)Prints a the contents of a deck to a PDF file.static voidprintToPDF(java.lang.String title, PaperProperties paper, java.awt.print.Printable printable, java.io.File pdfFile)Prints the contents of anyPrintableobject to a PDF file.static voidprintToPDF(java.lang.String title, java.awt.print.PageFormat pageFormat, java.awt.print.Printable printable, java.io.File pdfFile)Prints the contents of anyPrintableobject to a PDF file.static voidsetDefaultOutputQuality(float quality)Sets the default output quality level.static voidsetImplementationClassName(java.lang.String className)Sets the name of the concretePDFPrintSupport.PDFWriterclass to use.
-
-
-
Method Detail
-
isAvailable
public static boolean isAvailable()
Returnstrueif PDF support is available.- Returns:
trueifcreatePDFWriter()will not throw anUnsupportedOperationExceptionexception
-
printToPDF
public static void printToPDF(java.lang.String title, java.awt.print.PageFormat pageFormat, java.awt.print.Printable printable, java.io.File pdfFile)Prints the contents of anyPrintableobject to a PDF file.- Parameters:
title- the title of the PDF filepageFormat- the page format to useprintable- the content to printpdfFile- the PDF file to create
-
printToPDF
public static void printToPDF(java.lang.String title, PaperProperties paper, java.awt.print.Printable printable, java.io.File pdfFile)Prints the contents of anyPrintableobject to a PDF file.- Parameters:
title- the title of the PDF filepaper- the paper type to useprintable- the content to printpdfFile- the PDF file to create
-
printToPDF
public static void printToPDF(DeckEditor deckEditor, java.io.File pdfFile)
Prints a the contents of a deck to a PDF file.- Parameters:
deckEditor- the editor displaying the deck to printpdfFile- the PDF file to write- Throws:
java.lang.UnsupportedOperationException- if PDF support is not available- See Also:
isAvailable()
-
createPDFWriter
public static PDFPrintSupport.PDFWriter createPDFWriter()
Returns a new instance of aPDFPrintSupport.PDFWriter.- Returns:
- a new, uninitialized PDF writer instance
- Throws:
java.lang.UnsupportedOperationException- if no PDF support is available
-
getDefaultOutputQuality
public static float getDefaultOutputQuality()
Returns the default output quality level for newPDFPrintSupport.Configurations.- Returns:
- the default quality setting
-
setDefaultOutputQuality
public static void setDefaultOutputQuality(float quality)
Sets the default output quality level. This is a value between 0 and 1 inclusive, where higher values suggest higher quality output, generally at the cost of larger file size. This is the default quality level for newPDFPrintSupport.Configurations.- Parameters:
quality- the new quality setting- Throws:
java.lang.IllegalArgumentException- if the quality is not in the range 0 to 1.- See Also:
PDFPrintSupport.Configuration.setQuality(float)
-
setImplementationClassName
public static void setImplementationClassName(java.lang.String className)
Sets the name of the concretePDFPrintSupport.PDFWriterclass to use.- Parameters:
className- the fully qualified name of a class with a no-arg constructor that implementsPDFPrintSupport.PDFWriter, ornullto use the default class
-
getImplementationClassName
public static java.lang.String getImplementationClassName()
Returns the name of the concretePDFPrintSupport.PDFWriterclass to use.- Returns:
- the fully qualified name of a class use to create new
PDFPrintSupport.PDFWriters
-
-