0

私はこのような私のアプリでPDFファイルを取得しています:

NSURL* pdfURL = [NSURL URLWithString:urlStr];
CGPDFDocumentRef PDFDocument = CGPDFDocumentCreateWithURL((__bridge CFURLRef)pdfURL);
CGPDFPageRef PDFPage = CGPDFDocumentGetPage(PDFDocument, 1);

画像の場合、iPhoneに保存するためにこの方法を使用できることを知っています:

[UIImagePNGRepresentation(image) writeToFile:uniquePath atomically:YES];

しかし、プログラムでiPhoneにPDFファイルを書き込んだり保存したりする方法はありますか?

4

2 に答える 2

3

簡単な方法は次のとおりです。

NSData *myFile = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"your_url"]]; 
[myFile writeToFile:[NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], @"yourfilename.pdf"] atomically:YES];
于 2012-11-14T16:44:14.863 に答える
-5

UIImageを除いて、プログラムでiPadメモリにデータを保存する方法はありません。

于 2014-01-07T14:51:00.417 に答える