3

I am building cordova print plugin using EPSON epos iOS SDK, to use it with hybrid mobile apps( ionic framework based). The sdk provides methods for printing text and image. But I have to print HTML template using it. is there any way to do so?

like if I can prepare UIWebView object from the template and convert it into UIImage. I am new to iOS development so dont know any proper way of doing that.

Rahul Bhooteshwar
  • 1,675
  • 17
  • 31
  • In short, do you want to get the content of your view as an UIImage? – ntsh May 28 '15 at 08:38
  • Yes kind of. But the problem is that the app is not pure iOS application. So is there any way to do that inside cordova plugin's Objective C code?? – Rahul Bhooteshwar May 29 '15 at 04:51
  • I am not sure of Cordova, but as far as I know it's javascript, and you could use it to convert a div to image. Have you tried this? One example: http://jsfiddle.net/8ypxW/3/ which uses html2canvas library. – ntsh May 29 '15 at 09:27

1 Answers1

0

You can render the UIWebView offscreen, and then capture its as a UIImage. the answers below might help you solve the problem. One problem you may face is that UIWebView doesn't loads unless you add it on a UIWindow, this window can be any UIWindow object, not necessarily the window you are displaying to user.

How to get ENTIRE image from UIWebView including offscreen content

Does iPhone/iPad UIWebView need to be active view to render?

How do I save the contents of a UIWebView as an image

Community
  • 1
  • 1
Vinay Jain
  • 1,653
  • 20
  • 28