//创建pdf图形上下文
NSString *path = [NSHomeDirectory() stringByAppendingString:@"/Documents/pdf.pdf"];
NSLog(@"%@",path);
UIGraphicsBeginPDFContextToFile(path, CGRectZero, nil);
// CGContextRef context = UIGraphicsGetCurrentContext();
//创建pdf中某一页
UIGraphicsBeginPDFPage();
UIImage *image = [UIImage imageNamed:@"1.png"];
[image drawInRect:CGRectMake(0, 0, 200, 200)];
NSString *str = @"上海宝山";
[str drawInRect:CGRectMake(0, 220, 200, 100) withAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:30],NSForegroundColorAttributeName:[UIColor redColor]}];
UIGraphicsEndPDFContext();