user1354603
user1354603

Reputation: 4032

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];

Upvotes: 0

Views: 378

Answers (1)

Pradip Vanparia
Pradip Vanparia

Reputation: 1742

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.

Upvotes: 2

Related Questions