Directory

← Back

Html2Canvas Screenshot

Vaadin add-on that takes screenshots using html2canvas

Author

Rating

Popularity

100+

Html2Canvas Screenshot is a Vaadin add-on that makes taking screenshots of your clients' UIs extremely easy and with no Java applet or plugin required. You get the data URL, raw image bytes, and MIME type of the image as a response in a listener callback. The current version utilizes html2canvas 0.4.1.

Sample code

final Screenshot screenshot = new Screenshot();
screenshot.addScreenshotListener(new ScreenshotListener() {
    public void screenshotComplete(ScreenshotImage image) {
        Window window = new Window("Here's your screenshot", new Image(null, new ExternalResource(image.getDataURL())));
        window.setWidth("80%");
        window.setHeight("80%");
        addWindow(window);
    }
});
screenshot.takeScreenshot();
final Screenshot component = Screenshot.newBuilder()
  .withAllowTaint(true)
  .withBackground("#f00")
  .withHeight(768)
  .withWidth(1024)
  .withLogging(true)
  .withMimeType(ScreenshotMimeType.JPEG)
  .build();
component.addScreenshotListener(new ScreenshotListener() {
    public void screenshotComplete(ScreenshotImage image) {
        Window window = new Window("Here's your screenshot", new Image(null, new ExternalResource(image.getDataURL())));
        window.setWidth("80%");
        window.setHeight("80%");
        addWindow(window);
    }
});
component.takeScreenshot();

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Support Vaadin 8

Released
2017-02-06
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.2+
Vaadin 8.0+
Browser
Firefox
Safari
Google Chrome
Internet Explorer
Internet Explorer

Html2Canvas Screenshot - Vaadin Add-on Directory

Vaadin add-on that takes screenshots using html2canvas Html2Canvas Screenshot - Vaadin Add-on Directory
Html2Canvas Screenshot is a Vaadin add-on that makes taking screenshots of your clients' UIs extremely easy and with no Java applet or plugin required. You get the data URL, raw image bytes, and MIME type of the image as a response in a listener callback. The current version utilizes html2canvas 0.4.1.
Online