screenshot test

HTML

<script src="http://cdn.sencha.com/ext/gpl/4.2.1/ext-all-dev.js"></script>
<link rel="stylesheet" href="http://cdn.sencha.com/ext/gpl/4.2.1/resources/css/ext-all.css">
<script src="http://html2canvas.hertzen.com/build/html2canvas.js"></script>

JavaScript

Ext.define('MyApp.view.Login', {
    extend: 'Ext.window.Window',
    height: 220,
    width: 490,
    layout: 'fit',
    modal: true,
    buttonAlign: 'left',
    closable: false,
    items: [{
        xtype: 'form',
        frame: false,
        border: 0,
        layout: {
            type: 'hbox',
            align: 'middle'
        },
        fieldDefaults: {
            msgTarget: 'side',
            labelWidth: 55
        },
        items: [{
            xtype: 'container',
            flex: 1,
            padding: 10,
            layout: {
                type: 'vbox',
                align: 'stretch'
            },
            items: [{
                xtype: 'textfield',
                name: 'username',
                fieldLabel: 'Username',
                allowBlank: false,
                flex: 1
            }, {
                xtype: 'textfield',
                name: 'password',
                fieldLabel: 'Password',
                inputType: 'password',
                allowBlank: false,
                flex: 1
            }]
        }]
    }],
    buttons: [{
        text: 'Login',
        handler: function (button) {
            var win = button.up('window');
            win.makeScreenshot(button);
        }
    }],
    makeScreenshot: function (button) {
        debugger;
        //window.location.href = "mai lto:[email protected]";

        html2canvas(document.body, {
            onrendered: function (canvas) {
                new Ext.Window({
                    title: 'Screenshot',
                    width: 500,
                    height: 400,
                    resizable: true,
                    autoScroll: true,
                    preventBodyReset: true,
                    html: '<img src="' +canvas.toDataURL("image/png") +'" height="200"/>'
                }).show();
            }
        });
    }
});



Ext.create('MyApp.view.Login').show();