UIWebView:方便快捷,因此也就效率慢。
QLPreviewController和UIDocumentInteractionController:底层使用UIWebView,但是提供预览模式。
CGPDFDocument:较底层方法,当然需要不少代码。
重要:官方demo->ZoomingPdfViewer(一切都在里面)
资料:
1、
http://stackoverflow.com/questions/4121674/is-there-any-best-way-to-show-pdf-in-iphone-other-than-uiwebview-in-objective-c
It sounds like you may have some large vector calculations going on in your PDF. You can try re-constructing your PDF with flat images instead of vectors.
Code-wise QLPreviewController should be able to do what you want with a PDF, however it may use a UIWebView underneath. UIDocumentInteractionController also has a preview mode, but I suspect that it is using a QLPreviewController itself for it's preview.
You can also use the low level PDF functions, though this will be more difficult to do. Look at CGPDFDocument and it's related APIs in apple's documentation for more here.
2、
http://zhao-zhe.appspot.com/?p=139001
文章在该网页的较底部。多找找。标题是:2,预览pdf等文本文件与图片
iOS4中新增了类QLPreviewController,可以用于预览iWork documents,MS Documents,RTF,PDF,Images,CSV等文件.它包含在QuickLook.framework中,使用时需要包含头文件<QuickLook/QuickLook.h>.使用QLPreviewController需要实现代理QLPreviewControllerDelegate,QLPreviewControllerDataSource.
//
// YQuickLook.h
// YouX
//
// Created by zhezhao on 10-12-1.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <QuickLook/QuickLook.h>
@interface YQuickLook : NSObject <QLPreviewControllerDelegate,QLPreviewControllerDataSource>{
NSArray *paths;
}
@property (nonatomic, retain) NSArray *paths;
@end
//
// YQuickLook.m
// YouX
//
// Created by zhezhao on 10-12-1.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import "YQuickLook.h"
@implementation YQuickLook
@synthesize paths;
- (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller{
return [paths count];
}
- (id <QLPreviewItem>) previewController: (QLPreviewController *) controller previewItemAtIndex: (NSInteger) index{
NSURL *url = [NSURL fileURLWithPath:[paths objectAtIndex:index]];
return url;
}
- (void)dealloc {
[super dealloc];
[paths release];
}
@end
调用方法:
QLPreviewController *controller = [[QLPreviewController alloc] init];
YQuickLook *quickLook = [[YQuickLook alloc] init];
quickLook.paths = [NSArray arrayWithObjects:attachment.path,nil];
controller.delegate = quickLook;
controller.dataSource = quickLook;
[self.navigationController pushViewController:controller animated:YES];
分享到:
相关推荐
使用C#的界面库WPF显示PDF,也是使用的Mupdf库
pdf.js 手机端或H5显示pdf
在安卓内部显示pdf文件
根据PDF的存放路径,将PDF文件显示在JSP页面,可显示多个,也可显示固定的一个 根据具体需求在JSP页面显示一个或者多个PDF
在JFrame中使用PDFRenderer显示PDF文件,并实现PDF文件的放大,缩小以及查找PDF文件某一页
C# 如何读取和显示PDFC# 如何读取和显示PDFC# 如何读取和显示PDF
将generic文件夹拷贝到项目中,再建一个页面,然后用~/Content/generic/web/viewer.html?file=测试文件.pdf&watermark_txt=元宝182" width="800" height="550">到显示页面去,file=要显示的pdf文件,watermark_txt=...
可以在C#窗体应用程序中显示PDF内容,比较简单方便
在flex的web中显示pdf文件, 包含pdf转换swf的工具和java转换的类
网页中显示PDF文档的HTML代码,做电子杂志的朋友注意了,直接在网页中显示PDF文件,很方便的。
使用纯C#代码显示PDF文档示例代码,示例使用PDFLibNet类库将PDF的转换成图片,示例显示在PictureBox中显示图片的缓存技术
增加项: 10,输入pdf的URL网址,显示PDF,客户机没有任何痕迹; 11,增加当前显示PDF另存为功能;12,SavePdfToPicFile,保存PDF当前页为任意图片;13,GetPdfCurPageText 根据显示的当前页面,返回显示当前页面的...
qt中显示pdf 适合初级学习
这是一个在asp.net的webform中显示pdf文件的项目demo,其中包括所需的js css image 示例pdf文件 还有示例代码。如果需要可以直接拿来使用
YCanPDF(PDFView.OCX )是 YCanPDF 开发的显示 PDF 文件的标准控件,可以在任何支 持标准 OCX 的开发语言里面使用,支持 VC6、 VC2003、 VB、 Delphi
1.1版本,xpdf更新官网的最新版本(20101028) ...我会陆续更新并增加新的功能 源码我放在淘宝了(研究也很辛苦的),肯定能编译,并且毫无保留,自己还写了很多中文注释 有意向就联系 ...当前显示PDF另存为功能
通过URL下载PDF文件并调用PDF阅读器显示 以及通过WEBVIEW 显示PDF 文件
一般安卓浏览器打开pdf会直接下载,使用这个插件,就可以在移动端页面直接显示PDF文件了,就和电脑端使用PDF软件打开PDF文件一样。但是IOS可以直接显示pdf文件,所以该文档也有判断苹果安卓区分对待的方法。
pdf.js用于显示pdf文件 可操作pdf在页面上显示的工具
利用JS在HTML前台显示pdf文件,通过改js文件中的DEFAULT_URL来调用pdf文件