ADF Basics: Printing Behavior
HiI will be showing you how to use the ADF showPrintablePageBehavior Component, how to get what you want to display on the "Print Ready Page"
ADF Print Demo Application can be downloaded here
I Created two Pages, both of which have have the same Components (Nearly), both pages have a button either to "Print" the Table Alone, or the Whole Page.
On the page where it prints only the Table, I surrounded the table with a panelCollection, and in the toolbar Region, I put the button with the showPrintablePageBehavior.
<f:facet name="toolbar"> <af:toolbar id="t2"> <af:commandToolbarButton text="Print Table" id="ctb1"> <af:showPrintablePageBehavior/> </af:commandToolbarButton> </af:toolbar> </f:facet>
Before Printed |
Printed |
With the Page Print, I surrounded the whole page with a panelHeader and within that toolbar Region I added the same Button.
<f:facet name="toolbar"> <af:toolbar id="t2"> <af:commandToolbarButton text="Print Table" id="ctb1"> <af:showPrintablePageBehavior/> </af:commandToolbarButton> </af:toolbar> </f:facet>
Before Printed |
Printed |
Extra
If you don't want a component to show when in Printing modeuse this EL expression in the Applicable Property
"#{adfFacesContext.outputMode eq 'printable' ? false : true}
Panel Box, not to display header
showHeader="#{adfFacesContext.outputMode eq 'printable' ? 'never' : 'ifNeeded'}"
Regards
#bearMan.
No comments:
Post a Comment