Convert a View to PDF and email on iOS?

You must Login before you can answer or comment on any questions.

The result screen of my iPad app is a bunch of text and items in a 600x800 view. I'd like to provide a way for the user to email this view.

I already have hooked up the action button and know how to email text or html that I can create, but I am wondering if it possible to simply convert the view to a PDF and then automatically attach this to the email.

I see there's a "toImage()" method for the View object, how would I use that, if PDF not possible?


sdk 2.0.1, iOS 5.1, os 10.7.3

2 Answers

There are few js libs that can write pdf files, but being js I think they will be slow. Another solution would be to try to create a native pdf writer module.

I don't know any other solution at the moment.

— answered 1 year ago by Dan Tamas
answer permalink
4 Comments
  • @Dan What about sending an image of the view?

    — commented 1 year ago by Steve Lombardi

  • Yes, this is possible. Call the view.toImage() function and use the returned blob as the attachment to the email

    http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.UI.EmailDialog-method-addAttachment

    — commented 1 year ago by Dan Tamas

  • @Dan That worked well, thanks.

    — commented 1 year ago by Steve Lombardi

  • Show 1 more comment

Your Answer

Think you can help? Login to answer this question!