小编Nic*_*kes的帖子

使用Swift打印本地PDF

我在Objective-C中有一个打印例程,用于打印本地PDF文件.

我想在Swift中使用相同的例程.有人可以帮忙吗?

- (void)printFile:(NSURL *)url {

    if ([UIPrintInteractionController .canPrintURL(url]) {

        UIPrintInteractionController *
            controller = [UIPrintInteractionController
            sharedPrintController()];

        controller.printingItem = url;

        UIPrintInfo *printInfo = [UIPrintInfo printInfo];
        PrintInfo.outputType = UIPrintInfoOutputGeneral;
        PrintInfo.jobName = [url lastPathComponent];
        controller.printInfo = printInfo;

        controller.showPageRange = YES;

        [controller presentAnimated:YES completionHandler:Null];

    }

}
Run Code Online (Sandbox Code Playgroud)

pdf swift ios8

4
推荐指数
2
解决办法
6188
查看次数

标签 统计

ios8 ×1

pdf ×1

swift ×1