brinley / jSignature

jQuery plugin for adding web signature functionality
http://www.unbolt.net/jSignature
694 stars 530 forks source link

Background #24

Closed escobar1983 closed 11 years ago

escobar1983 commented 11 years ago

Hello. How to make jSignature works with img as background and how to export it with base64.

a make this

$("#signature").jSignature({color:"#000",lineWidth:2,width:'100%',height:'100%'});

onclick="alert($(\'#signature\').jSignature(\'getData\', \'base64\')) - to display data but this give me undeifned How to remove black line on canvas ?

dvdotsenko commented 11 years ago

@escobar1983

  1. Do you want "import image background" to work everywhere, including IE8 and lower?
  2. Base64 is a compression method. What do you want the underlying data format to be? PNG, SVG?
escobar1983 commented 11 years ago

Do you want "import image background" to work everywhere, including IE8 and lower? Yes Base64 is a compression method. What do you want the underlying data format to be? PNG, SVG? PNG

dvdotsenko commented 11 years ago

@escobar1983

jSignature already natively "supports" export of signature area as PNG. Check out image export format in getData API.

It's the first part of your request that I am afraid you will never (as in "next few years") see. IE7,8 relies on Flash-based Canvas emulator, which, at this time does not (and has no known to me forks that do) support importing bitmap data. I have heard that importing bitmaps is broken elsewhere (like 2.2.x 2.3.x Android browser).

The only alternative I can see is allowing you to provide a callback that "draws" to canvas using Canvas API. This still precludes reliable bitmap import, but does guarantee fairly reliable way to add vector-based elements to the canvas. Whatever you draw will export with 'image' export format, but NOT with vector-based signature formats like SVG, or super-compressed-and-custom Base30.

If you think exposing ability to "render to Canvas using Canvas vector elements API" will satisfy your needs, let me know.