使用 WebKit 捕获带有框架的网页
我正在开发一个 OSX 应用程序,在其中从加载的 Web 视图创建 CIImage。以下是执行此操作的代码片段:
NSView *docView = [[[webView mainFrame] frameView] documentView];
NSBitmapImageRep *imageRep = [docView bitmapImageRepForCachingDisplayInRect: [docView frame]];
[docView cacheDisplayInRect: [docView frame] toBitmapImageRep:imageRep];
CIImage *webPageImage = [[CIImage alloc] initWithBitmapImageRep: imageRep];
但是,使用此代码我无法捕获具有框架的网页。以下网页有框架: http://api.rubyonrails.org
如何解决此问题?
I am developing an OSX application in which I create an CIImage from web-view loaded. Following is the code snippet to do that:
NSView *docView = [[[webView mainFrame] frameView] documentView];
NSBitmapImageRep *imageRep = [docView bitmapImageRepForCachingDisplayInRect: [docView frame]];
[docView cacheDisplayInRect: [docView frame] toBitmapImageRep:imageRep];
CIImage *webPageImage = [[CIImage alloc] initWithBitmapImageRep: imageRep];
But, using this code I am not able to capture the webpage that has frames. Following web page has frames: http://api.rubyonrails.org
How do I solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论