Macos 如何在cocoa应用程序中使用PDFView?
我现在正在研究cocoa,所以对mac开发有点陌生。Macos 如何在cocoa应用程序中使用PDFView?,macos,cocoa,xcode4,pdfview,Macos,Cocoa,Xcode4,Pdfview,我现在正在研究cocoa,所以对mac开发有点陌生。 我想从我的服务器打开PDF。使用PDFView,这可能吗? 如果有人在这方面指导我,那将对我非常有帮助。 是否有在PDFView中打开PDF文件的示例代码 提前谢谢 我得到了答案 至少为我工作……) 我得到了答案 至少为我工作……) Swift版本(不要忘记导入石英模块) Swift版本(不要忘记导入石英模块) Swift 3.0版本:) Swift 3.0版本:) NSString *urlStr = [[NSBundle mainBund
我想从我的服务器打开PDF。使用
PDFView
,这可能吗?如果有人在这方面指导我,那将对我非常有帮助。
是否有在PDFView中打开PDF文件的示例代码 提前谢谢 我得到了答案 至少为我工作……) 我得到了答案 至少为我工作……) Swift版本(不要忘记导入石英模块) Swift版本(不要忘记导入石英模块) Swift 3.0版本:) Swift 3.0版本:)
NSString *urlStr = [[NSBundle mainBundle] pathForResource:@"1.pdf" ofType:nil];
NSURL *url = [NSURL fileURLWithPath:urlStr];
PDFDocument *pdfDoc = [[PDFDocument alloc] initWithURL:url];
[pdfView setDocument:pdfDoc];
guard let docPath = NSBundle.mainBundle().pathForResource("1", ofType: "pdf") else { return }
let docURL = NSURL.fileURLWithPath(docPath)
let pdfDocument = PDFDocument(URL: docURL)
guard let docPath = Bundle.main.path(forResource: "1", ofType: "pdf") else { return }
let docURL = NSURL.fileURL(withPath: docPath)
let pdfDocument = PDFDocument(url: docURL)
uxPdf.document = pdfDocument