所以我目前正在尝试打印一个我已经加载到
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];