Save a UIView that contains a UILabel,UIImageView and UITableView as PDF in Objective C
<p>My iOS app saves the selected contact details as PDF and displays it in a WebView.<br> My View shows the selected contacts image (in UIImage), name (in UILabel) and other details like phone numbers (in UITableView).<br>
Now, I need to save this view as a PDF and see it in another View.<br>
The method <code>createPDFfromUIView</code> that I use now saves my View as PDF.</p>

<p>But I can't see the whole table view in my PDF.<br>I need to scroll to see the whole table view.<br><br>How can I resolve this?</p>

<pre><code>-(void)createPDFfromUIView:(UIView*)aView saveToDocumentsWithFileName:(NSString*)aFilename
{
     // Creates a mutable data object for updating with binary data, like a byte array
    NSMutableData *pdfData = [NSMutableData data];
    // Points the pdf converter to the mutable data object and to the UIView to be converted
    UIGraphicsBeginPDFContextToData(pdfData, aView.bounds, nil);
    UIGraphicsBeginPDFPage();

    // draws rect to the view and thus this is captured by UIGraphicsBeginPDFContextToData
    [aView.layer renderInContext:UIGraphicsGetCurrentContext()];

    // 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:aFilename];

    // instructs the mutable data object to write its context to a file on disk
    [pdfData writeToFile:documentDirectoryFilename atomically:YES];
    NSLog(@"documentDirectoryFileName: %@",documentDirectoryFilename);
}
</code></pre>