Objective-C отображать PDF с сервера

Я пытаюсь отобразить PDF-файл с сервера в своем приложении.

Я попытался пойти по маршруту Document Interaction Controller, но он отображает файлы только в приложении, а не в Интернете :(

if (URL) {
    // Initialize Document Interaction Controller
    self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];

    // Configure Document Interaction Controller
    [self.documentInteractionController setDelegate:self];

    // Preview PDF
    [self.documentInteractionController presentPreviewAnimated:YES];
}

Будет ли UIWebView моим лучшим решением для отображения PDF с сервера? Не PDF на сайте, а на сервере \SEVERNAME\LHSD\PDFs\example.pdf


person user979331    schedule 15.09.2015    source источник


Ответы (1)


Лучший способ отобразить pdf-файл в target-c — загрузить pdf-файл в UIWebView.

Попробуй это :

NSString *stringUrl = @"YOUR-SERVER'S-PDF-FILE-URL";
    NSURL *url = [NSURL URLWithString:stringUrl];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];

UIWebView *webViewObj = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 300, 450)];
    [webViewObj loadRequest:request];
    [self.view addSubview:webViewObj];
person Mehul Sojitra    schedule 15.09.2015