Skip to content

Printing HTML elements with rgba style including alpha value does not work #499

Closed
@JScheiterbauer

Description

@JScheiterbauer

Describe the bug
Our customer reported printing problems. When printing HTML Content (or PDFs)
We reported this issue a while ago (see #341 ) and it was closed as wontfix. Now our customer urged it, so we need to find a solution.
The bug was initially reported that "Radio buttons" were printed incorrect.
We could find out that these radio buttons where in fact SVG graphics with style="fill:rgba()".
We cannot provide original files because of sensitive patient data, so we reduced the problem to a simple sample HTML file.
But we can provide a PDF that contains no sensitive data but has the problem: issue1.pdf

The fill:rgba style is printed incorrectly if an alpha value != 1 is set and no additional opacity is set.
f.e:
Bug reproduces:
style="fill:rgba(23,124,28,0.95);"
style="fill:rgba(23,124,28,0.3);"
Bug does not reproduce:
style="fill:rgba(23,124,28,1);"
style="fill:rgb(23,124,28);opacity:0.95;"
style="fill:rgba(23,124,28,0.95);opacity:0.5;"

A similar bug (might be because of another reason but has strangly same results) was reported by a customer when printing a PDF.
The PDF contained a diagram with X and Y axis and multiple curves showing clinical values.
The area under a yellow curve was filled with a yellow shaded area. The curve was printed correct, the shade was also missing, but was printed smaller on the upper left (similar behavior as with the RGBA SVG graphics), so I assumed it was the same problem (but might be a duplicate).
The bug with printing the PDF is only reproducable using JCEF (eg detailed MainFrame).
For reproducing it with CEFs cefclient.exe you have to add the application parameter "--no-sandbox".

To Reproduce
Steps to reproduce the behavior:

  1. Open default.MainFrame sample application.
  2. Load “svgRGBA.html” (is in attached svgRGBA.zip file, either load from file system via file:// or hosted by a webserver, it doesn’t matter); Or use this JSFiddle: https://jsfiddle.net/Phylanx/cem82jLz/3/
  3. Print the HTML content (Menu File → Print…). Use either a physical printer or a PDF printer (e.g. Microsoft PDF Printer).
    See result: svgRGBA.pdf

Expected behavior
Expected: The HTML document is printed as it is seen.
Instead: 2 of the three SVG graphics are printed, one is missing.
The missing one is printed on the upper left side and smaller, as if it was not upscaled or shrinked.

Screenshots

Versions (please complete the following information):
Windows 10 64 bit, Windows 11 64 bit
JCEF 32 bit
JCEF versions 2704, 3325, 3683, 6261, 6723

Also reproduced with newest JCEF version 6834 (132) with 64 bit on Feb 12th, 2025.

Additional context
Does the problem reproduce with the JCEF simple or detailed sample application at the same version?
The problem reproduces with:

  • detailed MainFrame
  • simple MainFrame

The problem reproduces with the cefClient.exe demo application of CEF with application parameter "--no-sandbox".

Also reproduced with Google Chrome with parameter "--no-sandbox" with the following versions:

  • Released Chrome 64 bit (133.0.6943.99 (Offizieller Build) (64-Bit) (cohort: Stable Installs & Version Pins))
  • Dev Chrome 32 bit (135.0.7012.4 (Offizieller Build) dev (32-Bit) (cohort: Dev))

We have the following forum thread running with this problem:
https://magpcss.org/ceforum/viewtopic.php?f=17&t=19952 (newer one)
Way earlier with the bug referenced here we had the following thread:
https://www.magpcss.org/ceforum/viewtopic.php?f=17&t=16664&start=10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions