-1

I have a view that has many textfields and values inserted into them. Now I want to save this view as an image or as a pdf.

Is there any way I can achieve this? I am using IOS 5.1 for the project

Rahul Kalidindi
  • 4,666
  • 14
  • 56
  • 92
  • 2
    Many duplicate questions here... one: http://stackoverflow.com/questions/3495370/image-from-uiview – Chris Trahey Jul 11 '12 at 05:17
  • possible duplicate of [Converting UIImage into PDF File](http://stackoverflow.com/questions/2445335/converting-uiimage-into-pdf-file) – CodaFi Jul 11 '12 at 05:23

1 Answers1

1

You can take screenshot of the view and save it:

UIGraphicsBeginImageContext(self.view.frame.size);
[[self.view layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Now you have a UIImage of the whole view content, you can use it the way you like..

Ankit
  • 1,684
  • 14
  • 14