- (void)createPDFfromUIView:(UIView*)aView saveToDocumentsWithFileName:(NSString*)aFilename
{
NSMutableData *pdfData = [NSMutableData data];
UIGraphicsBeginPDFContextToData(pdfData, aView.bounds, nil);
UIGraphicsBeginPDFPage();
CGContextRef pdfContext = UIGraphicsGetCurrentContext();
[aView.layerrenderInContext:pdfContext];
UIGraphicsEndPDFContext();
NSArray* documentDirectories = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES);
NSString* documentDirectory = [documentDirectoriesobjectAtIndex:0];
NSString* documentDirectoryFilename = [documentDirectorystringByAppendingPathComponent:aFilename];
[pdfDatawriteToFile:documentDirectoryFilenameatomically:YES];
NSLog(@"documentDirectoryFileName: %@",documentDirectoryFilename);
}