将nsstring转换为pdf格式然后发送邮件

时间:2013-11-25 10:42:40

标签: ios iphone objective-c pdf mfmailcomposer

-(void)sendmail
{
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];


[mailer setSubject:@"iOS School - MultipleAlertViews"];

NSArray *toRecipients = [NSArray arrayWithObjects:@"", nil];
[mailer setToRecipients:toRecipients];

NSString *        [emailBody appendString:[NSString stringWithFormat:@"<hr> <font face=\"verdana\" size=\"2\" color=\"black\"> <table width=\"700px\" border=\"1px;\"><tr><td width=\"200px\"><img src='%@' width=\"200\" height=\"200\"></td><td width=\"500px\"> <b>&nbsp%@/%@/%@ &nbsp &nbsp &nbsp &nbsp Price: %@%@ </b></br><hr>&nbsp %@ </br><hr></br><hr>&nbsp Gross Wt: %0.2f gms &nbsp &nbsp &nbsp &nbsp  Net Wt.: %@ gms </br><hr>&nbsp Dia: %d/%0.2f cts &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp Col.Stone: %d/%0.2f cts</td></tr></table></font>",



[mailer setMessageBody:emailBody isHTML:YES];

[self presentModalViewController:mailer animated:YES];
}

此处emailBody转换为pdf然后发送邮件,此处我不想编辑任何内容,或禁用键盘。

1 个答案:

答案 0 :(得分:2)

很抱歉这是不可能的,并且违反了Apple邮件撰写视图,这意味着您的应用程序可能会被拒绝执行不可编辑的电子邮件编辑器。

我唯一的建议是创建自定义电子邮件视图控制器并实现此功能,而不是使用Apple提供的。

另一个解决方案是您通过调用您的Web服务发送HTML代码。

了解更多详情:

Third party framework Using

Lock MFMailComposeViewController