title: How to capture screenshot of UIWebview with all the content?
body: <p>I am able to capture the screen shot of the entire webpage (including the off screen content). This is working fine on simulator, but on device it is crashing. Please help me on this, check the code below (<code>browserView</code> is the UIWebview).</p>
  
  <pre><code>UIImage *screenImage=[[UIImage alloc] init];
  UIScrollView *browserScrollableView=[[UIScrollView alloc] init];
  browserScrollableView=browserView.scrollView;   
  UIGraphicsBeginImageContext(browserScrollableView.contentSize);
  CGPoint savedContentOffset = browserScrollableView.contentOffset;
  CGRect savedFrame = browserScrollableView.frame;
  
  browserScrollableView.contentOffset = CGPointZero;
  browserScrollableView.frame = CGRectMake(0, 0, browserScrollableView.contentSize.width, browserScrollableView.contentSize.height);
  
  [browserScrollableView.layer renderInContext: UIGraphicsGetCurrentContext()];     
  screenImage = UIGraphicsGetImageFromCurrentImageContext();
  
  browserScrollableView.contentOffset = savedContentOffset;
  browserScrollableView.frame = savedFrame;
  UIGraphicsEndImageContext();
  
  NSLog(@"Captured image size is %f X %f",screenImage.size.width,screenImage.size.height);
  
  UIImageWriteToSavedPhotosAlbum(screenImage, nil, nil, nil);
  </code></pre>