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");
        }];
    }

你可能感兴趣的:(打印,WKWebView)