You can create a printable version of a page or iView, which also displays a Print button, enabling the user to print the page or iView.
On the preview page, the Print button is at the top of the page, and all other controls in the page are disabled.
To create a preview page of a specific page or iView, call the printIView method.
The following creates a print preview of the iView whose iView ID is stored in the IviewId context attribute in the PageService node:
IPageService pageService = (IPageService) WDPortalUtils
.getService(IPageService.KEY);
if (pageService == null) {
return;
}
pageService.printIView(wdContext.currentPageServiceNodeElement()
.getIviewId());