如何使用pdfkit iOS 11打开pdf文件? [英] How to use pdfkit ios 11 to open pdf file?

查看:91
本文介绍了如何使用pdfkit iOS 11打开pdf文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用新的iOS 11框架pdfkit打开PDF文件.

I am trying to open PDF file using new iOS 11 framework pdfkit.

但是我无法做到这一点.

But I am unable to do that.

所以请帮助我使用pdfkit框架打开文件.

So help me in opening the file using pdfkit framework.

先谢谢您

推荐答案

对于新的PDFKit,

For new PDFKit,

您需要导入PDFKit

然后创建一个PDFView视图,并提供一个PDFDocument来查看该视图的文档.检查以下代码以供参考.

Then create a view of PDFView and give a PDFDocument to view's document. Check the below code for reference.

let pdfView = PDFView(frame: self.view.bounds)
let url = Bundle.main.url(forResource: "pdfFile", withExtension: "pdf")
pdfView.document = PDFDocument(url: url!)
self.view.addSubview(pdfView)

这篇关于如何使用pdfkit iOS 11打开pdf文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆