WKWebView 打印页面

WKWebView打印页面的实现

    if ([UIPrintInteractionController isPrintingAvailable])
    {
        UIPrintInfo *pint = [UIPrintInfo printInfo];
        pint.outputType = UIPrintInfoOutputGeneral;
        pint.jobName = @"Print";
        pint.orientation = UIPrintInfoOrientationPortrait;
        pint.duplex = UIPrintInfoDuplexLongEdge;

        UIPrintInteractionController *pintController = [UIPrintInteractionController sharedPrintController];
        pintController.printInfo = pint;
        pintController.showsPageRange = YES;
        pintController.printFormatter = webView.viewPrintFormatter;

        [pintController presentAnimated:YES completionHandler:^(UIPrintInteractionController *printInteractionController, BOOL completed, NSError *error) {
        NSLog(@"handle error here");
        }];
    }
posted @ 2015-06-29 11:20  沙影无痕  阅读(228)  评论(0编辑  收藏  举报