0

我需要在我的应用程序中引入打印功能,它是用 phonegap 框架制作的。有从javascript实现airprint或使用本机方法的解决方案吗?谢谢。

4

2 回答 2

0

在 Monotouch 中,您可以只截屏:

    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;
    }
}
于 2011-06-11T02:06:44.333 回答
0

使用此处建议的代码为 phonegap 创建一个插件...

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

这将指向您

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

于 2011-06-02T02:56:42.957 回答