【发布时间】:2012-03-22 09:03:18
【问题描述】:
我想在 UIWebView 中显示 PDF 文件,我正在使用下面的代码进行此操作
NSString *path = [[NSBundle mainBundle] pathForResource:@"About Downloads" ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webViewContractViewer loadRequest:request];
我想要的只是我的 UIWebView Farm 高度和宽度应该随着 PDF 文件的高度和宽度动态调整,这样我的 UIWebView 中就不应该有垂直或水平滚动。
我正在使用代码获取我的 PDF 文件的宽度和高度
NSURL *pdfURL = [[NSBundle mainBundle] URLForResource:@"About Downloads.pdf" withExtension:nil];
CGPDFDocumentRef pdf = CGPDFDocumentCreateWithURL((__bridge CFURLRef)pdfURL);
CGPDFPageRef page = CGPDFDocumentGetPage(pdf, 1);
CGPDFPageRetain(page);
CGRect pageRect = CGPDFPageGetBoxRect(page, kCGPDFMediaBox);
谁能帮忙。有没有其他好的方法可以做到这一点。
【问题讨论】:
标签: iphone objective-c pdf