Skip to content

WPrintButton

Mark Reeves edited this page Jan 3, 2018 · 10 revisions

WPrintButton is a component for printing the current screen. It is a client-only print and the output is determined by the user's print and browser settings.

Creating a WPrintButton

WPrintButton has two constructors: use of the default constructor will result in the default text (Print in English) being set on the button.

// a default WPrintButton
WPrintButton button = new WButton();

// a WPrintButton with a specific text label
WButton button = new WButton("Print this page");

Accessibility

WPrintButton will be accessible if it is created with a reasonable labelling string - even if this string is not displayed on the final button because an image is displayed as the only content of the button.

WPrintButton printButton = new WPrintButton("Print");

At a bare minimum a WPrintButton must have at least one of:

  • a displayed text label (preferred);
  • a toolTip which adequately describes the purpose of the button; or
  • setting the accessibleText property to a value which adequately describes the purpose of the button.

For detailed information and methods to ensure your WPrintButtons are always accessible see WButton accessibility.

Access Keys

A WPrintButton may be given an access key to provide rapid keyboard access.

Setting a tool tip

See toolTip.

HTML output

WPrintButton will output a HTML button element. This is an interactive, form bound control and therefore may not be used in any context where the content model forbids this content category. The allowed content of WPrintButton is a String label and optional image.

Refer to the information on WButton for more details about creating and adding content to a WPrintButton and the properties available. The following aspects of WButton are not applicable to WPrintButton:

Related components

Further information

Clone this wiki locally