Bug 231268 - On Monterey, images in WebView don't always appear when rendered into a PDF context
Summary: On Monterey, images in WebView don't always appear when rendered into a PDF c...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-05 16:49 PDT by Brad Andalman
Modified: 2022-05-09 07:41 PDT (History)
6 users (show)

See Also:


Attachments
Xcode project to reproduce the bug on Monterey (1.90 MB, application/zip)
2021-10-05 16:49 PDT, Brad Andalman
no flags Details
Incorrect PDF generated on Monterey (41.48 KB, application/pdf)
2021-10-05 16:49 PDT, Brad Andalman
no flags Details
Correct PDF generated on Big Sur (1.87 MB, application/pdf)
2021-10-05 16:50 PDT, Brad Andalman
no flags Details
Correct PDF generated on Catalina (1.88 MB, application/pdf)
2021-10-05 16:50 PDT, Brad Andalman
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brad Andalman 2021-10-05 16:49:25 PDT
Created attachment 440294 [details]
Xcode project to reproduce the bug on Monterey

We have an application that uses an unmapped WebView to render the content of a webpage into a PDF. With Monterey, we've noticed that sometimes images just don't appear in the generated PDF.

On Monterey, if we switch to rendering from an onscreen WebView, it becomes more likely that images will appear in the final PDF…but it still isn’t guaranteed.

I’ve attached an Xcode project that illustrates this. By default, this project will create an unmapped WebView, load some static HTML, and render it to “~/Desktop/missingImages.pdf”. On Big Sur and Catalina, you will see an image of a cute puppy on the first page of the PDF. On Monterey, you will see a big red square instead of the image (red is the background-color for that <img> element).

In the project, you can change an “#if 0” to “#if 1” so that it uses an onscreen web view. On Monterey, you will likely see the puppy. As we mentioned above, though, this still doesn’t ALWAYS happen. 

I've filed this regression using Feedback Assistant (FB9681094), but am reporting this here, too, in case it's more of a WebKit issue than a Monterey one.
Comment 1 Brad Andalman 2021-10-05 16:49:52 PDT
Created attachment 440295 [details]
Incorrect PDF generated on Monterey
Comment 2 Brad Andalman 2021-10-05 16:50:13 PDT
Created attachment 440296 [details]
Correct PDF generated on Big Sur
Comment 3 Brad Andalman 2021-10-05 16:50:41 PDT
Created attachment 440297 [details]
Correct PDF generated on Catalina
Comment 4 Radar WebKit Bug Importer 2021-10-06 17:35:10 PDT
<rdar://problem/83960036>
Comment 5 Brad Andalman 2021-10-11 11:41:15 PDT
I see that this bug has been imported into Radar. Is there any way for us to know whether this regression will be fixed before Monterey is released? Thanks so much for any information you might have!
Comment 6 Sam Sneddon [:gsnedders] 2022-05-09 07:41:00 PDT
rdar://83910579