Print Page Contents Builder
In this topic ...
Use this builder to specify an area of a page that you want to print when a button or link is clicked. The Builder generates JavaScript (and optionally a button/link/image button to invoke that JavaScript).
This JavaScript is used to create a pop-up window that displays the page content that will be printed. Once the content stream is sent to the printer, the pop-up window can be automatically closed.
This Builder is useful when you want to print a portion of a browser page rather than the entire page. This allows you to print the content of a single portlet in a page that contains multiple portlets.
Note that Make sure this builder is not applied to the same tag on a page as the Excel Export builder. Both of these builders write the ID attribute to the tag, so that whichever builder is placed last will overwrite the ID attribute provided by the former builder, making the former builder inoperable. If both builders are needed for the same area of the page, wrap one tag by another tag and apply the builders to the different tags.
How do I...
Select a portion of a page for printing?
Specify the page on which the element to be printed is located in "Source Page" input. You will get the complete set of locations (tags) on the page in "Source Element". Select the HTML/XML element you want to print in this input. The contents of the page within the selected HTML/XML element will be written to the browser pop-up window that the print operation is executed from.
Locate a print control on a page?
Specify the location of the print button, link, or image via the "Print Button/Link Location" builder input. When the portlet is displayed, the print control will be located on the tag you selected.
Specifying Inputs
This Builder takes the inputs described in the table below. For help on inputs common to many or all builders such as those in the Properties and HTML Attributes input groups, see "Using the Builder Call Editor"
Input Name Description Name Enter a name for this builder call. The Designer displays this name in the Builder Call List. Contents to Print Source Page Use the Source Page input to specify the page or pages on which this builder call will act. Source Element Use the Source Element input to specify the location on the source page that needs to be printed. Display Control Add Print Button / Link Select they type of page control to use to initiate printing. We can choose:
- Image Button - To use an image to represent / initiate the print operation.
- Button - To use a standard button to represent / initiate the print operation.
- Link - To use a link to represent / initiate the print operation.
- None - To create a custom print implementation. For example, this option might be selected to allow you to use a feature of another builder that this builder does not provide, such as the alternate images for hover and pressed that the Image Button builder provides.
Print Button / Link Location Use the Page Location input to specify the location on the page where the print control will be placed. See "Locating Control Builders on Pages" for detailed documentation about the Page Location input and page location syntax.
Print Button / Link label Enter the text string to be used a the print button or link label. For example: "Print Page Content"
Image File Available when Image Button is selected above. Specify the path to the print icon/image to be used to initiate printing.
Alt Image Text Available when Image Button is selected above. Specify the Alt (alternative) text, which specify a textual replacement for the image, to be displayed or otherwise used in place of the image.
Popup Window Properties Auto Close Popup Window Enable this check box to close the pop-up window when printing is complete. Disable this box to allow window to remain open until closed by user. (You might want to do this while developing/debugging your application / portlet.)
Disable Buttons / Links Enable this check box to disable use of buttons/links in the browser pop-up window that the print is executed from.. Typically we need to disable links/buttons so that the user doesn't have two usable browser windows open on the same application. The pop-up window is intended only for printing.
Popup Height Enter the height (in pixels) of the pop-up window. Popup Width Enter the width (in pixels) of the pop-up window. Advanced Generated JavaScript Function This is the name of the generated JavaScript function that creates the pop-up window and executes the print job. This name is shown to allow you to use another Builder Call (such as your own Button, Link or Image Button builder call) to invoke the JavaScript created by this builder call.
We can copy this value from this builder after hitting Apply/OK in this builder call, and paste it into another builder call (such as Button) in the Script area of that control builder call.
Objects this Builder Creates
The Builder creates a JavaScript function on the specified page that in turn will create a pop-up window with the specified page contents and then print those page contents. It optionally generates a Button, Link or Image Button on the specified page, depending on the radio button selection above.