如何将签名转换为数据:image / png; base64 in react?

时间:2017-12-21 16:43:02

标签: javascript reactjs react-native react-redux signature

我正在使用react-signature-tab组件

<div className="form-group row">
 <label className="col-sm-2 form-control-label text-xs-right"> Witness-1 Signature: </label>
 <div style= {{backgroundColor: '#f1f1f1'}}>
  <SignaturePad clearButton="true" />

</div>

 <label className="col-sm-2 form-control-label text-xs-right"> Witness-2 
 Signature: </label>
<div style= {{backgroundColor: '#f1f1f1'}}>
<SignaturePad clearButton="true" />
</div>

 </div>

After signing from this component on click on submit I need to convert the image into "data:image/png;base64, {{imagedata}}" 我已经浏览了react-signature-pad文件,用于获取签名作为数据网址,我需要使用signature.toDataURL();.

我是这个组件的新手我无法找到如何使用此方法toDataURl()的确切解决方案。

请帮我解决这个问题。

0 个答案:

没有答案