title: Objective-C Full UIView to PDF
body: <p>I have this code here that takes my UIView in puts it into a PDF. My issue I am having is that my view is a detail view controller and is scrollable and the PDF only gets what inside the detail view controller at that time and not a full view, if I move around in the detail view, it will capture whatever part I am on, not the full thing. Is what I am trying to do possible?</p>
  
  <pre><code>- (IBAction)Share:(id)sender {
  
      NSMutableData *pdfData = [NSMutableData data];
  
      // Points the pdf converter to the mutable data object and to the UIView to be converted
      UIGraphicsBeginPDFContextToData(pdfData, spreadSheet.bounds, nil);
      UIGraphicsBeginPDFPage();
      CGContextRef pdfContext = UIGraphicsGetCurrentContext();
  
  
      // draws rect to the view and thus this is captured by UIGraphicsBeginPDFContextToData
  
      [spreadSheet.layer renderInContext:pdfContext];
  
      // remove PDF rendering context
      UIGraphicsEndPDFContext();
  
      // Retrieves the document directories from the iOS device
      NSArray* documentDirectories = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES);
  
      NSString* documentDirectory = [documentDirectories objectAtIndex:0];
      NSString* documentDirectoryFilename = [documentDirectory stringByAppendingPathComponent:@"test.pdf"];
  
      // instructs the mutable data object to write its context to a file on disk
      [pdfData writeToFile:documentDirectoryFilename atomically:YES];
      NSLog(@"documentDirectoryFileName: %@",documentDirectoryFilename);
  
  
      UIActivityViewController * activityController = [[UIActivityViewController alloc] initWithActivityItems:@[pdfData] applicationActivities:nil];
  
      UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activityController];
  
      [popup presentPopoverFromRect:CGRectMake(self.view.frame.size.width - 36, 60, 0, 0)inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
  
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have been really struggling with this, I can't get the full view into a PDF, I have also been thinking of going to route of taking my NSMutableArray and my NSArray which is the data used in my UIView and try to covert that into a PDF but that sounds very time consuming to make format it nicely, unless someone knows of way to do that. I guess I am confused on which route I should take.</p>