我可以使用UIWebView
打开PDF(下面的代码)。我想做的是
1)在View控制器的后台打开PDF
2)对PDF做一些评论,画上它
3)应该可以拍摄视图控制器的快照
在步骤1之上的3个步骤中,我做了3个,我坚持做第2个,如何在UIWebView
上绘制
打开PDF的代码
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)];
NSURL *targetURL = [NSURL URLWithString:@"https://www.iscp.ie/sites/default/files/pdf-sample.pdf"];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
[self.view addSubview:webView];
拍摄WebView快照的代码
-(UIImage*)captureScreen:(UIView*) viewToCapture
{
UIGraphicsBeginImageContext(viewToCapture.bounds.size);
[viewToCapture.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewImage;
}