Soft Frame Works

JPDF Custom Print Attributes

The JPS (Java Print Service), on which the JPDF is based, provides a large number of Standard Print Attributes to control printing. These include attributes that specify the paper size, page orientation, page margins, and so on. A Print Attribute Set is used when a Print Job is submitted to the JPS for execution. The JPS uses this Attribute Set to print according to the Standard Print Attribute values within it.

NOTE: The JPDF makes use of and extends the capabilities of the JPS (Java Print Service). The JPS is part of the Standard Edition JRE (Java Runtime Environment) – beginning with JRE version 1.4. JPS classes are contained in packages which begin with javax.print.

The JPDF provides many Custom Print Attributes which allow you to specify additional printing options. These are used by the JPDF Printers (JPDF classes which render application data for printing purposes). The JPDF Custom Print Attributes are stored in the same Print Attribute Set as the Standard Print Attributes, and are used by the Printer during the printing process. The JPS and Printers ignore any attributes in the set that they do not recognize or which are not relevant in the current context.

Your application may use a single Print Attribute Set, or multiple Print Attribute Sets one of each type of data element that can be printed. The attribute set would typically contain a mixture of Standard and Custom print attributes. These can be placed in the attribute set programmatically or by the end-user using a Page Setup or Print dialog. A common usage scenario is to programmatically establish an initial Print Attribute Set for your application, and then provide Page Setup and Print dialogs which allow the user to modify some or all of the attributes in this set. When the user exits your application you can employ some persistence mechanism to save the current Attribute Set contents so that it can be restored the next time the user enters your application. (Class serialization may be used for attribute set persistence, as attribute sets are serializeable.)

The following tables list the Custom Print Attributes provided by the JPDF (individual JPDF Printers support a subset of these). The General, Aligning/Positioning/Scaling, and Page Headers/Footers tables contain attributes which can pertain to any type of printed material. The subsequent tables contain attributes that pertain to printing various types of Swing components.

General
BackgroundColor Specifies the background color for the material to be printed.
ContentFont Specifies the font used for the text to be printed.
ContentFrame Determines whether a frame is printed surrounding the printed content.
ForegroundColor Specifies the foreground color for the material to be printed.
NumberUpPrintPageEdges Specifies whether the Logical Page edges are to be printed when printing multiple Logical Pages on each Physical Page. (This is used in conjunction with the NumberUp Standard Attribute.)
PageFrame Determines whether a frame is printed just inside the margins of each page.
PrintPageOddEven Specifies whether only odd numbered or only even numbered pages are to be printed.

Aligning/Positioning/Scaling
AlignmentFactorHorizontal Specifies the horizontal alignment of the content to be printed. Can be any value between zero and one (0.0 for left aligned, 0.5 for center aligned, and 1.0 for right aligned).
AlignmentFactorVertical Specifies the vertical alignment of the content to be printed. Can be any value between zero and one (0.0 for top aligned, 0.5 for center aligned, and 1.0 for bottom aligned).
FitToPages Specifies the number of pages (horizontally and vertically) to be used. The material to be printed is scaled to fit the specified pages.
FitToPagesSelected Determines whether the printed material is scaled to fit the pages specified by the FitToPages attribute.
OffsetBottom Specifies an offset from the bottom margin for positioning of the content to be printed.
OffsetLeft Specifies an offset from the left margin for positioning of the content to be printed.
OffsetRight Specifies an offset from the right margin for positioning of the content to be printed.
OffsetTop Specifies an offset from the top margin for positioning of the content to be printed.
ScaleFactor Specifies the scale (magnification) factor for the printed material.
ScaleFactorMax Specifies the maximum scale (magnification) factor to be allowed.
ScaleFactorMin Specifies the minimum scale (magnification) factor to be allowed.

Page Headers/Footers
PageFootDocument Specifies the content of the Page Footer using a Text Document.
PageFooterLine Determines whether a line separating the Page Footer from the page content is printed.
PageFooterOnFirstPage Determines whether Page Footers are printed on the first page.
PageFootFirst2Last Provides two indepedent Page Footers: one which specifies the content of the Footer on the first page, and another which specifies the content of the Footer on the remaining pages.
PageFootHtml Specifies the content of the Page Footer using HTML.
PageFootNotes Specifies the content of the Page Footer using three strings (left, center, right).
PageHeadDocument Specifies the content of the Page Header using a Text Document.
PageHeaderLine Determines whether a line separating the Page Header from the page content is printed.
PageHeaderOnFirstPage Determines whether Page Headers are printed on the first page.
PageHeadFirst2Last Provides two indepedent Page Headers: one which specifies the content of the Header on the first page, and another which specifies the content of the Header on the remaining pages.
PageHeadHtml Specifies the content of the Page Header using HTML.
PageHeadNotes Specifies the content of the Page Header using three strings (left, center, right).

Swing Components (JComponent)
BackgroundColorOnPage Determines whether the Component's background color is printed on the entire imageable region of the page (as opposed to just the part of the page in which the Component is printed).
UseBackgroundColor Determines whether the Component's background color is printed.

Swing Text Components (JTextComponent)
HighlightSelections Determines whether the selected section of text is highlighted when printed.
WrapToFitPage Determines whether the text is wrapped to fit the available page width.

Swing Table Components (JTable)
ContentHeadersOnEveryPage Determines whether the table headers are repeated on every page.
HighlightSelections Determines whether the selected table cells are highlighted when printed.
TableGridHorizontal Determines whether table horizontal grid lines are printed.
TableGridVertical Determines whether table vertical grid lines are printed.
SplitColumns Determines whether table columns are bisected at the right page margin.

Swing Tree Components (JTree)
HighlightSelections Determines whether the selected tree branches are highlighted when printed.
TreeExpansion Specifies how the tree is expanded for printing purposes.


© Copyright 2003-2014 Soft Frame Works. All rights reserved. Privacy Policy   Site Map