I want to convert UIWebview (height = 4224,width = 568)to pdf in order to send it by mail when I used the application below for the code that broke on this line ([self.reportWebView.layer renderInContext:UIGraphicsGetCurrentContext()]). Please give me some good suggestions. Thanks.
CGRect frame = self.reportWebView.frame;
CGSize fittingSize = [self.reportWebView sizeThatFits:CGSizeZero];
frame.size = fittingSize;
self.reportWebView.frame = frame;
NSMutableData *pdfData = [NSMutableData data];
@autoreleasepool {
UIGraphicsBeginPDFContextToData(pdfData, self.reportWebView.bounds, nil);
UIGraphicsBeginPDFPage();
[self.reportWebView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIGraphicsEndPDFContext();
}
Infaz source
share