10
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

WKWebViewでAirPrintした話と、MacをAirPrintサーバーにしてMacのプリンタでAirPrintした話

10
Posted at

Stack OverflowにUIWebViewでAirPrintする話が載っていた(airprint - iOS Air print for UIwebview - Stack Overflow)ので、同じようにWKWebViewで出来るかやってみた。

出来た。

WKWebViewでAirPrintした話

以下、WKWebViewのインスタンスはself.wkWebView

    UIPrintInfo *pi = [UIPrintInfo printInfo];
    pi.outputType = UIPrintInfoOutputGeneral;
    pi.jobName = self.wkWebView.title;
    pi.orientation = UIPrintInfoOrientationPortrait;
    pi.duplex = UIPrintInfoDuplexLongEdge;
    
    UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
    pic.printInfo = pi;
    pic.showsPageRange = YES;
    pic.printFormatter = self.wkWebView.viewPrintFormatter;
    [pic presentAnimated:YES completionHandler:^(UIPrintInteractionController *pic2, BOOL completed, NSError *error) {
        // indicate done or error
    }];

MacをAirPrintサーバーにしてMacのプリンタでAirPrintする

AirPrint対応のプリンタがない開発環境では、
MacをAirPrint Serverにして、
Macに接続されたプリンタからAirPrintすることが出来る。

[Netputing » handyPrint v5]
(http://www.netputing.com/applications/handyprint-v5/)は、MacをAirPrintサーバーにしてくれるアプリ。

スクリーンショット-2015-04-27-11.33.39.png

上手くいかない場合、設定>共有>プリンタ共有 を有効にする必要があるかも。

10
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?