Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JScheiterbauer opened this issue Feb 11, 2025 · 4 comments
Labels
bug Bug report

Comments

@JScheiterbauer
Copy link

JScheiterbauer commented Feb 11, 2025

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".

Google chrome does not have this problem.

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

@JScheiterbauer JScheiterbauer added the bug Bug report label Feb 11, 2025
@JScheiterbauer
Copy link
Author

Also another user (salvadordf) reported the problem in the meanwhile using CEF4Delphi.
He could reproduce the problem also with cefclient.exe (with parameter --no-sandbox).
Not using "--no-sandbox" did not reproduce the problem, so this "--no-sandbox" parameter might cause this problem.

Is there a relation to printing and the "--no-sandbox" flag?

@JScheiterbauer
Copy link
Author

Added additional reproduction info (JSFiddle for HTML/CSS part, sample PDF for PDF printing problem):

@salvadordf
Copy link

I just tested this issue again with the MiniBrowser demo from the CEF4Delphi project which uses CEF 132.3.2. That demo has a normal windowed browser.

The final PDF in Windows 10 doesn't have all SVG images
The PDF file obtained with the demo running in Linux Mint 22.1 shows all the SVG images.

LinuxMint.pdf
windows.pdf

@JScheiterbauer
Copy link
Author

Added reproduction on windows with newest JCEF version 6834 (132) with 64 bit on Feb 12th, 2025.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report
Projects
None yet
Development

No branches or pull requests

2 participants