Results 1 to 2 of 2

Thread: How to Save the Signature from SigaturePad as an Image to Local HardDrive

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    1

    Post How to Save the Signature from SigaturePad as an Image to Local HardDrive

    Code:
    onReady: function() {
            
        var tp = new Ext.Panel({
            fullscreen:true,
            layout: {type: 'vbox', align: 'stretch'},
            id: 'mainPanel',
            items: [{
            xtype: 'panel',
            id: 'signaturePanel',
            plugins: [new simFla.ux.plugins.signaturePad({width: 500, height: 100})]
            },{
            xtype: 'panel',
            id: 'imagePanel',
            width: 500,
            height: 100,
            layout: {type: 'vbox', align: 'stretch'}
            }
    ],
            
            dockedItems: [{
            xtype: 'toolbar',
            dock: 'top',
            title: 'Signature Pad'
            },{
            xtype: 'toolbar',
            dock: 'bottom',
            items: [{
                xtype: 'button',
                text: 'Reset',
                handler: function() { Ext.getCmp('signaturePanel').plugins[0].reset()}
            },{
                xtype: 'spacer'
               },{
                xtype: 'button',
                text: 'Get Image',
                handler: function() {
                    Ext.getCmp('imagePanel').el.createChild({
                    tag: 'div',
                    style: 'background-image: url(' + Ext.getCmp('signaturePanel').plugins[0].getSignatureAsImage('DATA') + '); width: 500px; height: 100px'
                    
                    });                
                    Ext.getCmp('imagePanel').doComponentLayout();  
              }
            },{
                xtype : 'button',
                text: 'storeImage',
                handler : function(){
                    var str = "store image";
                    var img = Ext.getCmp('signaturePanel').getValue();
                    alert(img);
                }
            }]
            }],
            
        });
    }



    The above code is for signature pad. I am able to get the image from the above red marked syntax and can display on same page.

    I want to save the file as an image in my local drive location.

    Can anybody provide me the code to resolve this.
    Last edited by skirtle; 6 Nov 2011 at 7:53 AM. Reason: Added CODE tags

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    Due to browser restrictions, JavaScript alone does not have access to the file system. You will have to prompt to download which a quick Google search will help you with that part.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •