Breaking News
Home / iOS / iOS Snippets / How to display a remote PDF file in iOS UIWebView?

How to display a remote PDF file in iOS UIWebView?

Snippet

  1. (void) displayUrlInWebView
  2. {
  3.         CGRect rect = [[UIScreen mainScreen] bounds];
  4.         CGSize screenSize = rect.size;
  5.        
  6.         UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,screenSize.width,screenSize.height)];
  7.         webView.autoresizesSubviews = YES;
  8.         webView.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
  9.        
  10.        
  11.         NSURL *url = [NSURL URLWithString:@"http://www.justsikh.com/files/hukamnama.pdf"];
  12.         NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
  13.        
  14.         [webView loadRequest:urlRequest];
  15.        
  16.         [window addSubview:webView];
  17.         [webView release];
  18.        
  19. }
[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Advertisment ad adsense adlogger