I mean: user click some “print” button and printer start printing. Is it that possible?
Please take in account that already exist a server process behind (via AJAX) that can return success to print (or html to show, whatever) or error to show an alert. That is not the problem.
EDIT:
After some quick comments (thanks!) I meant “open print dialog” not “start printing”.
You already have an HTML page; the one where the button is. You can have different style sheets for the page for the screen and the printer using the
mediaasttribute or@mediadirective. You can have different looks and layout for when the page is printed, or you can even have a completely different set of elements.Example:
To have the button print the page, just use the
printmethod:This will of course not just start printing, but opens the print dialog. To print something without that dialog you would need to run a component in the browser, but starting the component would require user confirmation, so you would get a dialog anyway, and a much more intimidating one.