As the title says, I need to display a PDF file stored in a remote server without downloading it on the device just by using an URL link. Is it possible to do it by using the Quick Look
framework?
I am using this code below:
- (void)openDocument {
QLPreviewController *docPreviewController = [[QLPreviewController alloc] init];
[docPreviewController setDataSource:self];
[docPreviewController setDelegate:self];
[docPreviewController setCurrentPreviewItemIndex:sender.tag];
[self.destinationViewController presentViewController:docPreviewController animated:true completion:nil];
}
- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller {
return 1;
}
- (id<QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index {
return [NSURL fileURLWithPath:@"http://www.domain.com/file.pdf"];
}
But I have this problem in the console:
UIDocumentInteractionController: invalid scheme https. Only the file scheme is supported.
I have resolved by using UIDocumentInteractionController
UIDocumentInteractionController *viewer = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:path]];
viewer.delegate = self;
[viewer presentPreviewAnimated:YES];