tags:

views:

249

answers:

1

Hi, All

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...

+2  A: 

An image might be your best option. See http://stackoverflow.com/questions/501496/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);
psychotik
is this will capture all the content even the scrollable content out side of the screen(means content below the viewable area)... ?or only snapshot(means only viewable area) ?
yakub_moriss
you control it based on the value to pass to the UIGraphicsBeingImageContext function. See http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIKitFunctionReference/Reference/reference.html#//apple_ref/c/func/UIGraphicsBeginImageContext
psychotik
thanks for your responce psychotik, but i want to convert it in pdf...is there any way ?or can we open pdf from website in UIWebView ? or not ?if yes then can we save it to the local disk space in iPhone ?please ans all my questions because i am little bit confuse about it...
yakub_moriss