[IOS]PDF阅读
来源:互联网 发布:qt linux sleep头文件 编辑:程序博客网 时间:2024/04/20 05:17
[IOS]PDF阅读
Demo地址:http://download.csdn.net/detail/u012881779/9053759
内容:将一个PDF文件分页阅读,页面结构分两部分,覆盖全页的正文部分和页面下方的导航栏部分,并且正文与导航关联了一个对应关系。个人比较懒,就不描述细节了,清晰的PDF文件一般都比较大,若有下载Demo便自己替换reading.pdf文件看看效果。
若没有PDF文件的话,到百度文库里面下载就是,或者把Word转为PDF 。
随便放一段代码在这里呢,没啥好写的
#import "ViewController.h"#import "RoboDocument.h"#import "RoboViewController.h"@interface ViewController ()<RoboViewControllerDelegate>@end@implementation ViewController- (IBAction)PDFReadAction:(id)sender { NSString *password = @""; //直接获取的资源路径无法使用 //NSString *filePath = [[NSBundle mainBundle] pathForResource:@"reading" ofType:@"pdf"]; //将资源写入沙盒再获取路径 NSString *filePath; if([self preparePDF]){ filePath = [self getPDFPath]; } RoboDocument *document = [RoboDocument withDocumentFilePath:filePath password:password]; if (document != nil) { RoboViewController *roboViewController = [[RoboViewController alloc] initWithRoboDocument:document small_document:nil]; [roboViewController showDocumentPage:1 fastScroll:NO]; roboViewController.valueDate = [[filePath componentsSeparatedByString:@"/"] lastObject]; roboViewController.delegate = self; roboViewController.readOrPreview = YES; [self.navigationController pushViewController:roboViewController animated:YES]; }}- (NSString*)getPDFPath { NSArray *pathsToDocuments = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [pathsToDocuments objectAtIndex:0]; NSString *dbPathInDoc = [documentsDirectory stringByAppendingPathComponent:@"reading.pdf"]; return dbPathInDoc;}- (BOOL)preparePDF{ NSFileManager *fm = [NSFileManager defaultManager]; NSString *pathBundle = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"reading.pdf"]; NSString *pathdb = [self getPDFPath]; if (![fm fileExistsAtPath:pathdb]) { return [fm copyItemAtPath:pathBundle toPath:pathdb error:nil]; } return YES;}@end
示意图:
0 0
- [IOS]PDF阅读
- ios PDF阅读和下载
- iOS阅读PDF的方法
- PDF阅读
- C# 在线PDF阅读
- Ubuntu PDF阅读
- C# 在线PDF阅读
- 优道PDF阅读控件
- Cortex_a7_mpcore_r0p5_trm.pdf阅读总结
- android pdf阅读
- pdf阅读器官网
- android pdf阅读开发
- Android PDF阅读
- 《SpyGlass_CDC_Training_Slides_510_20Aug2013.pdf》阅读笔记
- 下载阅读pdf文档
- Android 阅读PDF文档
- C# 在线PDF阅读
- 【iOS开发-6】iOS框架以及手册的在线阅读和PDF版本的iOS Technology Overview下载
- JQuery如何判断标签指定属性是否存在
- C++循环顺序队列
- Linux系统强大的控制台、终端和shell的关系
- Offer被拒后,张一鸣决定跟技术人才聊聊,你的下一份工作应该在哪里
- 【敏捷软件开发:原则、模式与实践】之代码重构
- [IOS]PDF阅读
- uva 1304 - Art Gallery(半平面相交)
- CentOS 7 下安装 Redis 2.8.7
- XML example with RESTEasy + JAXB
- js要入门?
- OGG安装配置文档
- Android studio中正确引入so文件的方法
- python文件中的__name__=='__main__'的使用及调用其他py文件中的函数方法
- uva 10084 - Hotter Colder(多边形切割)