MohammedYakub M.
MohammedYakub M.

Reputation: 2941

iphone : How to convert webpage(UIWebView) to pdf

i want to convert my webpage(displayed in UIWebView) contents in pdf file.

which can be stored at perticular directory (document dir/any user defined dir).

So later on it can be viewable to user either internet connection not available.

is there any possibilities to perform this functionality.

how can i do this...

Thanking you in advance...

Upvotes: 0

Views: 1937

Answers (1)

psychotik
psychotik

Reputation: 39029

An image might be your best option. See Take snapshot of view / WebView programmatically

To get the image, you'll want to use:

UIGraphicsBeginImageContext(self.bounds.size);

[theView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

Then, to save to the Photos Library:

UIImageWriteToSavedPhotosAlbum(viewImage,nil,NULL,NULL);

Upvotes: 2

Related Questions