Bug 75514

Summary: First sentence is missing or clipped when printing a inline PDF
Product: WebKit Reporter: Chris Petersen <c.petersen87>
Component: FramesAssignee: Alexey Proskuryakov <ap>
Status: CLOSED FIXED    
Severity: Normal CC: ap, mitz
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.7   
Description Flags
Additional sample inline PDF test cases to reproduce issue
Sample PDF examples for clipping issue
proposed fix mitz: review+

Description Chris Petersen 2012-01-03 20:16:32 PST
First sentence is missing or clipped in printing a inline PDF

1) Launch Webkit TOT r103998 under Mac OS X 10.7.2 and go to http://www.cs.tut.fi/~jkorpela/html/iframe-pdf.html
2) Ctrl-click on a inline PDF and choose Print Frame
3) Notice clipping appears on the top Heading of the first page ( noticeable in the print preview )
4) Click PDF --> Open PDF in Preview
5) Notice the first sentence on each page in the PDF generated is either missing or clipped
6) Compare this to the result you get if you ctrl-click on inline PDF and choose 'Open Frame in New Window'. Then choose Print --> Click PDF --> Open PDF in Preview. No clipping occurs under this condition so it seems to open happen when printing a PDF in a frame ....
Comment 1 Chris Petersen 2012-01-03 20:18:47 PST
Created attachment 121044 [details]
Additional sample inline PDF test cases to reproduce issue
Comment 2 mitz 2012-01-03 20:32:36 PST
Chris, do the PDFs print (or preview) for you with the Safari-generated headers and footers (timestamp at the top right, URL at the bottom left, page number at the bottom right)?
Comment 3 Chris Petersen 2012-01-03 20:47:57 PST
Yes, the heading ( timestamp ) and footings ( URL and page #) are displayed in both print thumbnail and PDF in Preview app. The clipping issue is present in both. See attachment. Clipping.pdf shows the problem. Compare to no_clipping_in_this_pdf .
Comment 4 Chris Petersen 2012-01-03 20:48:47 PST
Created attachment 121051 [details]
Sample PDF examples for clipping issue
Comment 5 Chris Petersen 2012-01-03 21:02:44 PST
Hmm. I think I just go my own answer.. Both header and  footer are enabled on a page so that is what I get and of course it clips the top portion of the page. When this is turned off, the clipping issue no longer occurs. Printing a PDF in a window doesn't have header/footer enabled so this doesn't happen like it mentioned above. So bottom line this isn't a frame issue like I thought.  Sorry for jumping the gun.
Comment 6 mitz 2012-01-03 21:04:06 PST
This is a valid issue, and thanks for reporting it. Further investigation may lead to the conclusion that the issue needs to be fixed in Safari, though.
Comment 7 mitz 2012-01-03 21:05:00 PST
(Headers and footers should never be enabled when printing a PDF).
Comment 8 Chris Petersen 2012-01-03 21:31:27 PST
Interesting enough I upgraded to Safari 5.1.2 from 5.1.1. Now I don't get the "Print Frame" menu item when I ctrl click on the inline PDF ( mentioned in Step 2 ). This is a change in the app apparently.
Comment 9 Alexey Proskuryakov 2012-01-04 10:51:11 PST
Created attachment 121124 [details]
proposed fix
Comment 10 mitz 2012-01-04 11:04:40 PST
Comment on attachment 121124 [details]
proposed fix

View in context: https://bugs.webkit.org/attachment.cgi?id=121124&action=review

> Source/WebKit2/ChangeLog:14
> +        Do not ask the embedder about headers and footers when printing a PDF.

Why use the term “embedder” here? In OS X, at least, frameworks and libraries have clients, not embedders. Moreover, the object being consulted here is called “the UI client”.
Comment 11 Alexey Proskuryakov 2012-01-04 11:26:57 PST

Committed <http://trac.webkit.org/changeset/104049>.

> Now I don't get the "Print Frame" menu item when I ctrl click on the inline PDF ( mentioned in Step 2 ). This is a change in the app apparently.

Tracking that as <rdar://problem/10643191>.
Comment 12 Chris Petersen 2012-01-04 21:09:21 PST
Excellent ! Verified fixed in Webkit NB r104114 running under mac OS X 10.7.2 ( Safari 5.1.1 )