2012-03-12 8 views
1

このコードを使用してサーバーからpdfファイルをダウンロードしています。CGPDFDocumentRefでダウンロードしたpdfを表示するには?

NSString *urlString = @"https://developer.apple.com/library/ios/documentation/uikit/reference/UILabel_Class/UILabel_Class.pdf"; 

    NSURL *url = [NSURL URLWithString:urlString]; 

    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; 
    [request setDownloadDestinationPath:[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"UILabel.pdf"]]; 
    [request setDelegate:self]; 
    [request startAsynchronous]; 

ダウンロード機能は正常に動作しています。しかし、私はCGPDFDocumentRefでダウンロードしたpdfを表示する必要があります。

ありがとうございます。あなたのPDFドキュメントディレクトリにそのPDFファイルを保存し、そこから以下のようにCGDocumentrefを使用して、PDFファイルやディスプレイをretriveダウンロードした後

答えて

3

CFURLRef pdfURL = (CFURLRef)[[NSURL alloc] initFileURLWithPath:[documentsDirectory stringByAppendingPathComponent:source]]; 
     //file ref 
     CGPDFDocumentRef pdfRef = CGPDFDocumentCreateWithURL((CFURLRef) pdfURL); 
+0

はどうもありがとうございました。それは正常に動作しています。 – Thukaram

+0

@Ram大歓迎 –

関連する問題