J2PrinterWorks Documentation Copyright © 2009 by Wildcrest Associates All Rights Reserved. (Version: 5.0, Date: March 6, 2009) |
Overview and
Features
For example, to print a fully-paginated JTextPane the following code is all that is required:
import com.wildcrest.j2printerworks.*;
J2Printer printer = new J2Printer();
J2TextPrinter textPrinter = new
J2TextPrinter(yourJTextPane);
printer.print(textPrinter);
J2PrinterWorks classes
J2PrinterWorks consists of the following primary classes:
J2Printer | manages the Java PrinterJob class, prints one or more Pageables (the Java class defining a set of printable pages) |
J2Printer14 | J2Printer subclass supporting JDK 1.4+ printing features (printer discovery, cross-platform dialogs, etc.) |
J2PrinterWebStart | J2Printer subclass supporting printing from Java Web Start applications using the JNLP APIs |
Flowable | interface for printing
components that
can start
and/or end in the middle of pages |
J2TextPrinter | prints any JTextPane, JEditorPane, or JTextArea as a Pageable or a Flowable |
J2TablePrinter | prints any JTable as a Pageable or a Flowable |
J2TreePrinter | prints any JTree as a Pageable or a Flowable |
J2ListPrinter | prints any JList as a Pageable or a Flowable |
J2PanelPrinter | prints any JPanel or simple Components and Images as a Pageable or a Flowable |
J2ComponentPrinter | prints any (Java or third-party) Component as a Pageable or a Flowable |
J2FlowPrinter | prints any series of
Flowables back-to-back
as a Pageable or a Flowable |
Detailed J2PrinterWorks Features
The following are the features of each of the main classes of J2PrinterWorks:
Printing mechanism Classes: J2Printer J2Printer14 J2PrinterWebStart |
Pageable & Book support (prints one or
more Pageables including your own) Per-Pageable control of headers/footers, margins, orientation, centering, scale Print Preview dialog, including page controls, zoom controls, and one or two page display Developer-customizable Print Preview dialog using icon buttons and toolbar Anti-aliased print preview display Support for English, French, German, Japanese, Korean, Italian, Spanish, Dutch, and Swedish locales Page Setup dialog Improved wait cursor support for dialogs Background printing thread with print progress events and PrintingEventHandler adapter class "Silent" printing (no Print Dialog) "N-up" printing Print to Postscript file (requires JDK 1.4 or later) , direct to Postscript printer support Print to PDF file (using open source iText.jar component) Display and print PDF file (using Adobe Acrobat Reader) Print to HTML slide show Control page number of first page of document Java Web Start printing support using the JNLP APIs Support for Headless operation Supports (under JDK 1.4.x or later): printer discovery programmatic printer selection printer properties cross-platform or native dialogs Complete source code for 32 sample programs Complete source code for 3 print dialogs, 2 page setup dialogs, and 2 print preview dialogs |
Common features Classes: J2TextPrinter J2TablePrinter J2TreePrinter J2ListPrinter J2PanelPrinter J2ComponentPrinter J2FlowPrinter |
Paginates across multiple pages Headers & footers (left, center, and right, first vs. rest-of-pages control) Headers & footers can contain multiple lines, rich text, images, date, time, & page numbering Automatic localization of default date, time, and page number strings in headers and footers Margins (left, right, top, and bottom) Centering (horizontal and/or vertical) Orientation (portrait, landscape) Scaling (percentage or fit-to-page(s)) Optional surrounding box and white background Support for Java Borders Control maximum gap before page breaks |
Additional features J2TextPrinter |
Prints any JTextPane, JEditorPane, or
JTextArea
class or subclass Paginates over multiple pages vertically Breaks pages on line boundaries Can reflow text to page width or preserve WYSIWYG layout Supports native JTextPane (StyledDocument) rich text formatting Also supports HTML and RTF documents (subject to Java limitations) "Direct print" for printing user entries in HTML <form> Embedded graphics (e.g., .gif, .jpg, Image, ...) Embedded components (e.g., JLabel, JPanel, JTable, ...) |
Additional features J2TablePrinter |
Prints any
JTable or JTable subclass Paginates over multiple pages horizontally & vertically Separate horizontal & vertical pagination modes BREAK_ON_ROWS, BREAK_ON_COLUMNS pagiantion modes break on row and/or column boundaries BREAK_ON_COLOR pagination mode breaks on color (e.g. gridline) boundaries, handles complex (e.g. nested) JTables SHRINK_TO_FIT pagination mode rescales to fit with a single page width and/or height Print area (row & column subset) Column header replication (all pages, top pages only, or none) Row header replication (all pages, left pages only, or none) Variable row height (JDK 1.3 or later) & column width Supports custom table cell renderers |
Additional features J2TreePrinter |
Prints any JTree
or JTree subclass Breaks pages on tree node (row) boundaries Paginates over multiple pages vertically Automatically rescales JTree to fit available page width Supports custom tree cell renderers |
Additional features J2ListPrinter |
Prints any
JList or JList subclass Breaks pages on list item (row) boundaries Paginates over multiple pages vertically Automatically rescales JList to fit available page width Supports custom list cell renderers Supports layout orientations HORIZONTAL_WRAP and VERTICAL_WRAP (JDK 1.4 or later) |
Additional features J2PanelPrinter |
Prints any
JPanel or JPanel subclass Also can be used for smaller (<1 page) Components, Containers wtth smaller Components, and Images SHRINK_TO_FIT mode rescales to fit within single page width and height TILE mode paginates over multiple pages horizontally and vertically, breaking on pixel boundaries BREAK_ON_COMPONENTS mode paginates horizontally and vertically, breaking on contained Component boundaries SHRINK_TO_WIDTH mode rescales to fit within single page width, breaking vertically on pixel boundaries |
Additional
features J2ComponentPrinter |
Prints any Java Component or subclass thereof, including
many third-party Components Appropriate for larger (multi-page) Components, Containers, and Images Separate horizontal & vertical pagination modes SHRINK_TO_FIT mode rescales to fit within single page width and/or height TILE mode paginates over multiple pages horizontally and/or vertically, breaking on pixel boundaries BREAK_ON_COMPONENTS mode paginates horizontally and/or vertically, breaking on contained Component boundaries BREAK_ON_COLOR mode paginates horizontally and/or vertically, breaking on color (e.g. white space) boundaries |
Additional features J2FlowPrinter |
Can print any
sequence of Flowables
back-to-back as a single Pageable Per-Flowable control of scaling and centering Additional Flowables include VerticalGap, HorizontalLine, PageEject Used to embed multi-page tables, images, etc. in rich text documents including captions, titles, legends, etc. |
Other product features |
General-purpose
ImagePanel including support for scaling and Java Borders General-purpose JLabel subclass with better control of HTML fonts and color Works under JDK 1.2.x, 1.3.x, 1.4.x, 1.5.x, 1.6.x Works under Windows, Mac, Unix Includes one year Annual Maintenance contract (renewable) Complete source code for 32 sample programs Developer-based pricing, no run-time royalties |