title: Saving entire NSView contents, which is inside an NSScrollView
body: <p>I'm trying to save contents of an NSView as an image, but, only the image visible inside the scrollview is saved.</p>
  
  <p>Here is the actual image loaded in the view:
  <img src="https://i.stack.imgur.com/T84l0.jpg" alt="actual image">.</p>
  
  <p>But this is how I'm able to save the image:
  <img src="https://i.stack.imgur.com/c5BBl.png" alt="saved image"></p>
  
  <p>Is there any way to save the entire image in the NSView?</p>
  
  <p>This is how I'm saving my NSView subclass:</p>
  
  <pre><code>- (void)save
  {
      [self lockFocus];
      NSBitmapImageRep* rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:[self bounds]];  
      [self unlockFocus];
  
      NSData* data = [rep representationUsingType:NSPNGFileType properties:nil];
  
      NSString* string = NSHomeDirectory();
      NSString* pth1 = [string stringByAppendingPathComponent:@"ttx.png"];
  
      [data writeToFile:pth1 atomically:YES];
  }
  </code></pre>
  
  <p>This method is in the View i want to save.</p>