简体   繁体   中英

Create PDF file from HTML Body and Sending as mail attachment, iOS

I have a HTML body as a NSString and would like to send it as an pdf-attachment. I'm quite new to iOS and can't figure out how, see code below.

NSString* body = "<html><body>stuff</body></html>"
MCOMessageBuilder * builder = [[MCOMessageBuilder alloc] init];
[builder setHTMLBody:body];

MCOAttachment *pdf = ... //body to pdf
[builder addAttachment:pdf];

Try this github iOS-htmltopdf . Its working for me. This code create one pdf file. store that file into document directory, and attach the pdf file in mail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM