MonoTouch:打印到网络打印机

时间:2011-04-25 14:16:29

标签: iphone printing xamarin.ios airprint

我是iPhone开发人员的新手。

我正在评估是否将Monotouch或objC用于潜在应用。

该应用程序需要能够将图片打印到网络打印机。

我已经看过几篇关于如何使用cocoa touch / objc的帖子。

找不到使用monotouch执行此操作的任何示例。

使用MonoTouch是否可行/支持

这是必备功能。

由于

1 个答案:

答案 0 :(得分:1)

这应该这样做,我把它检查成:

“print”目录中的

http://github.com/migueldeicaza/monotouch-samples

void Print ()
{
    var printInfo = UIPrintInfo.PrintInfo;
    printInfo.OutputType = UIPrintInfoOutputType.General;
    printInfo.JobName = "My first Print Job";

    var textFormatter = new UISimpleTextPrintFormatter ("Once upon a time...") {
        StartPage = 0,
        ContentInsets = new UIEdgeInsets (72, 72, 72, 72),
        MaximumContentWidth = 6 * 72,
    };

    var printer = UIPrintInteractionController.SharedPrintController;
    printer.PrintInfo = printInfo;
    printer.PrintFormatter = textFormatter;
    printer.ShowsPageRange = true;
    printer.Present (true, (handler, completed, err) => {
        if (!completed && err != null){
            Console.WriteLine ("error");
        }
    });
}