所以我目前正在尝试打印一个我已经加载到
Cocoa应用程序中的WebView的pdf,如果你想看到你需要滚动的整个内容,它的大小.问题在于,无论何时打印,它只打印当前在WebView中显示的内容而不是整个页面,代码如下:
[[[[WebView mainFrame] frameView] documentView] print:sender];
解决方法
我看到这是一个老问题,但由于还没有任何答案,我想我会为任何搜索提供这个.
nsprintInfo *printInfo = [nsprintInfo sharedPrintInfo]; // This is your chance to modify printInfo if you need to change // the page orientation,margins,etc [printInfo setorientation:NSLandscapeOrientation]; nsprintOperation *printOperation = [yourWebView.mainFrame.frameView printOperationWithPrintInfo:printInfo]; // Open the print dialog [printOperation runoperation]; // If you want your print window to appear as a sheet instead of a popup,// use this method instead of -[runoperation] [printOperation runoperationModalForWindow:yourWindow delegate:self didRunSelector:@selector(printDidRun) contextInfo:nil];
原文地址:https://www.jb51.cc/iOS/334933.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。