Open Bug 1912253 Opened 6 months ago Updated 5 months ago

old.reddit.com/r/anime/comments/1ejvd6l/ranime_karma_ranking_discussion_week_5_summer_2024/lghf95e/ - Huge PDF file generated (due to cairo gradients)

Categories

(Core :: Printing: Output, defect, P3)

Firefox 130
Desktop
Linux
defect

Tracking

()

Tracking Status
firefox129 --- affected
firefox130 --- affected

People

(Reporter: railioaie, Unassigned)

References

()

Details

Attachments

(1 file)

Environment:
Operating System: Linux
Firefox version: Nightly 131.0a1 (2024-08-05)

Preconditions:
Clean profile
ETP set to Strict

Steps to reproduce:

  1. Navigate to: https://old.reddit.com/r/anime/comments/1ejvd6l/ranime_karma_ranking_discussion_week_5_summer_2024/lghf95e/

  2. Press CTRL+P

  3. Unselect "Print backgrounds" = gives small PDF of 118 KB, opens OK

  4. Select "Print backgrounds" to include pictures: gives PDF file of ~170 MB, which Okular can not show (maybe freezes trying to render).

  5. Print the same page using Chrome with pictures = gives PDF file of 1.6 MB size, opens OK

Expected Behavior:
The document is saved correctly

Actual Behavior:
The file is saved in very different dimensions FF vs Chrome(1.6 MB vs 170 MB)

Notes:

  • Screenshot attached
  • Reproducible on the latest build of Firefox Nightly and Release
  • Not reproducible on Chrome

Looks like Chrome might be doing some compression on background images or something? Moving to the printing folks to take a look.

Component: Site Reports → Printing: Output
Product: Web Compatibility → Core

Hm, I extracted the images saved into PDFs from Firefox and Chrome using pdfimages - they are of similar sizes. If anything, PDF from Firefox have a smaller total image size. It did take forever with the Firefox PDF, but well, it's huge, and there was no any warning/error message.
Another interesting fact - File info claims this massive PDF page to be 2 pages long, despite the fact that the preview shows 6 pages (Which matches Chrome).

I also see the following console output:

[GFX3-]: Surface size too large (exceeds extent limit)!
[GFX2-]: Allowing surface with invalid size (Cairo) Size(48960,63360)
[GFX3-]: Surface size too large (exceeds extent limit)!
[GFX2-]: Allowing surface with invalid size (Cairo) Size(48960,63360)
[GFX3-]: Surface size too large (exceeds extent limit)!
[GFX2-]: Allowing surface with invalid size (Cairo) Size(48960,63360)
[GFX3-]: Surface size too large (exceeds extent limit)!
[GFX2-]: Allowing surface with invalid size (Cairo) Size(48960,63360)

The severity field is not set for this bug.
:boris, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(boris.chiou)

Here's a profile: https://share.firefox.dev/3B1yf5p

It seems Cairo's gradient rendering is exploding badly. Jonathan, does this ring a bell?

Severity: -- → S3
Flags: needinfo?(boris.chiou) → needinfo?(jfkthame)
Summary: old.reddit.com/r/anime/comments/1ejvd6l/ranime_karma_ranking_discussion_week_5_summer_2024/lghf95e/ - Different dimension of the file when printing FF vs. Chrome → old.reddit.com/r/anime/comments/1ejvd6l/ranime_karma_ranking_discussion_week_5_summer_2024/lghf95e/ - Huge PDF file generated (due to cairo gradients)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #4)

Here's a profile: https://share.firefox.dev/3B1yf5p

It seems Cairo's gradient rendering is exploding badly. Jonathan, does this ring a bell?

Not really; but it wouldn't surprise me if there are cases where cairo decides it doesn't know how to express a gradient "natively" in the pdf output, and falls back to generating a (huge) rasterized representation.

I see a somewhat milder version of the issue on macOS, too (which has a very different cairo backend): without backgrounds, I get a 452K pdf, while with backgrounds included it explodes to 46.4MB. Chrome's version (with backgrounds) is 1.7MB.

It'd be interesting to identify the specific image or images that trigger this.

Flags: needinfo?(jfkthame)
Attached file Minimized Test Case

This generates a > 10 MiB PDF file.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: