简体   繁体   English

从UIWebView提取jSignature图像

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM