当前位置: 动力学知识库 > 问答 > 编程问答 >

printing - Print local html file from uiwebview (iOs)

问题描述:

i need to introduce printing feature to my app, that is made with phonegap framework. there is a solution to implement airprint from javascript or use native method? thanks.

网友答案:

Create a plugin for phonegap using the code suggested here...

https://groups.google.com/forum/#!topic/phonegap/nAt0TqsStgc

which will point you to

http://marceloprogramming.blogspot.com/2010/12/resolving-runtime-issues-with-airprint.html

网友答案:

You could , in Monotouch, just take a screen shot:

    public class ScreenShot
{
    public static UIImage TakeScreenShot (UIView view)
    {
        RectangleF canvasRect = view.Bounds;
        UIGraphics.BeginImageContext (canvasRect.Size);

        CGContext ctx = UIGraphics.GetCurrentContext ();
        ctx.FillRect (canvasRect);
        view.Layer.RenderInContext (ctx);

        UIImage newImage = UIGraphics.GetImageFromCurrentImageContext ();

        UIGraphics.EndImageContext ();

        return newImage;
    }
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: