1
我必须发送HTML文本作为附件与PDF扩展名。发送html文本作为PDF格式的ios附件邮件
代码:
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.mailComposeDelegate = self;
NSArray *toReceipents =[NSArray arrayWithObjects:@"", nil];
[mailViewController setToRecipients:toReceipents];
[mailViewController setSubject:strMailMessage];
NSLog(@"Mail Message:%@ %@",strMailMessage,appDelegate.strShareText);
NSData* data = [appDelegate.strShareText dataUsingEncoding:NSUTF8StringEncoding];
[mailViewController setMessageBody:appDelegate.strShareText isHTML:YES];
[mailViewController addAttachmentData:data mimeType:@"application/pdf" fileName:@"Medication file.pdf"];
[self presentModalViewController:mailViewController animated:YES];
[mailViewController release];
注:当我下载的pdf文件我得到相同text.but我想显示PDF文档