[英]Extract jSignature image from UIWebView
I am trying to extract signature bitmap from UIWebView
. 我试图从
UIWebView
提取签名位图。
This is HTML code: 这是HTML代码:
<canvas class="jSignature" width="200" height="120" style="margin: 0px; padding: 0px; border: none; height: 120px; width: 200px;"></canvas>
This code works in JS: 此代码在JS中有效:
$('.signature').jSignature('getData','image')
This is my piece of code: 这是我的代码:
NSString *sign = [self.webView stringByEvaluatingJavaScriptFromString:@"$('.signature').jSignature('getData','image')"];
So sign
is: 所以
sign
是:
<object returned empty description>
Is there any way to get error message from stringByEvaluatingJavaScriptFromString
to debug this problem? 有什么方法可以从
stringByEvaluatingJavaScriptFromString
获取错误消息来调试此问题?
Found solution. 找到解决方案。 Read doc of jSignature: http://willowsystems.github.io/jSignature/#/about/
阅读jSignature的文档: http ://willowsystems.github.io/jSignature/#/about/
So it should be: 因此应该是:
NSString *sign = [self.webView stringByEvaluatingJavaScriptFromString:@"$('.signature').jSignature('getData')"];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.