There appears to be no way for a user to render the current web page to a single PDF file *exactly* as it appears on screen. The value of [[[[webView mainFrame] frameView] documentView] bounds] is incorrect when used to specify the bounds for a subsequent dataWithPDFInsideRect: call on the documentView. The resulting PDF file on pages with lots of text, such as the sample page loaded in this app, are clipped at the very end. In addition, WebKit does not respect the user's media style preferences when calling dataWithPDFInsideRect:. Apparently, a different text layout engine is being used, which is why the bounds result is incorrect. To see a graphic example, build and run the attached application, follow the instructions, and examine the results.
Created attachment 12687 [details] A tiny Mac OS X 10.4 Cocoa application demonstrating the bug.
Erich, thanks for the bug report! Have you tested this against WebKit ToT (tip-of-tree)? There have been numerous improvements in WebKit since the version that shipped with Tiger. Info on checking out and building WebKit is here: http://webkit.org/.
(In reply to comment #2) Wow! Great! It looks like the bounds are correct in the latest nightly (1/26/2007). Also, the text looks identical, so it appears the correct typesetter is being used now, too. Fanstastic!