pdf 作为 iOS 设备中的电子邮件附件
我想附上作为电子邮件附件创建的 pdf。我使用以下教程在 iOS 设备上创建 pdf。
下载的pdf可以在这个路径查看: /Users/“用户名”/库/应用程序支持/iPhone模拟器/“您的应用程序目录”。
我还没有尝试在 ios 设备上运行它,但我需要将其作为电子邮件附加。
教程链接是: http://www.ioslearner.com/generate-pdf-programmatically-iphoneipad/
任何建议。
I would like to attach pdf created as an email attachment. I used following tutorial to create pdf on iOS device.
The downloaded pdf can be viewed at this path:
/Users/”Username”/Library/Application Support/iPhone Simulator/”Your App Directory”.
I have not tried running this on ios device but I need to attach it as an email.
Link for tutorial is :
http://www.ioslearner.com/generate-pdf-programmatically-iphoneipad/
Any suggestion.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
创建一个 MFMailComposeViewController 并调用 addAttachmentData:mimeType:fileName: 。数据将是您创建的 PDF。 mimeType 将为
application/pdf
。文件名将是电子邮件附件中文件的名称。代码可能如下所示:在本教程中,您需要将 PDF 渲染为 NSMutableData 对象:
然后在将来的某个时刻,您需要将该 pdfData 传递给 MFMailComposeViewController 。
Create a
MFMailComposeViewController
and calladdAttachmentData:mimeType:fileName:
. The data will be the PDF you created. The mimeType will beapplication/pdf
. And the fileName will be the name of the file in the email attachment. The code might look like something below:From the tutorial you'll need to render your PDF into a NSMutableData object:
Then at some point in the future you'll need to pass that pdfData to the
MFMailComposeViewController
.请参阅 文档 了解
MFMailComposeViewController
。具体来说,您正在寻找addAttachmentData:mimeType:fileName:
方法。这应该能让你继续前进。See the docs for
MFMailComposeViewController
. Specifically, you're looking for theaddAttachmentData:mimeType:fileName:
method. That should get you going.