嗨我创建的PDF文件使用Quartz框架在IOS.i需要下载该文件在本地文件夹,如保存图像在simulator.any告诉我如何做到这一点。本地保存PDF在IOS
我在提前创建PDF
-(NSString*)getPDFFileName
{
NSString* fileName = @"Invoice.PDF";
NSArray *arrayPaths =
NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory,
NSUserDomainMask,
YES);
NSString *path = [arrayPaths objectAtIndex:0];
NSString* pdfFileName = [path stringByAppendingPathComponent:fileName];
return pdfFileName;
}
-(void)showPDFFile
{
NSString* fileName = @"Invoice.PDF";
NSArray *arrayPaths =
NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory,
NSUserDomainMask,
YES);
NSString *path = [arrayPaths objectAtIndex:0];
NSString* pdfFileName = [path stringByAppendingPathComponent:fileName];
UIWebView* webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
NSURL *url = [NSURL fileURLWithPath:pdfFileName];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView setScalesPageToFit:YES];
[webView loadRequest:request];
[self.view addSubview:webView];
}
- (void)viewDidLoad
{
NSString* fileName = [self getPDFFileName];
[PDFRenderer drawPDF:fileName];
[self showPDFFile];
[super viewDidLoad];
}
感谢代码..
从那里你所得到的文件?你是在应用程序中创建和存储,还是从远程服务器下载而不是存储? – 2014-03-27 08:48:33
我正在用app.i创建pdf页面,需要将 –