Quote:
Originally Posted by RUser
Hi Belkin,
Do you got any option to save Webview contents as PDF?
If yes,Kindly help Me
|
To save the webview contents as an image use the following code.
Code:
CGSize sixzevid=CGSizeMake(1024,1100);
UIGraphicsBeginImageContext(sixzevid);
[webview.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *imageData = UIImagePNGRepresentation(viewImage);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *pathFloder = [[NSString alloc] initWithString:[NSString stringWithFormat:@"%@",@"new.png"]];
NSString *defaultDBPath = [documentsDirectory stringByAppendingPathComponent:pathFloder];
[imageData writeToFile:defaultDBPath atomically:YES];
After converting it in to an image you can easily convert it as pdf.