Printing HTML Elements with RGBA does not work

Having problems with building or using the JCEF Java binding? Ask your questions here.

Printing HTML Elements with RGBA does not work

Postby Phylanx » Tue Sep 10, 2024 3:59 am

Hi!

We have the problem that JCEF prints HTML incorrect if it contains elements with class "rgba".
Test HTML to reproduce this problem is attached: svgRGBA.zip
Or: test with my fiddle, I just provided: https://jsfiddle.net/Phylanx/cem82jLz/3/

Current versions we can reproduce the problems with:
[*] 6723 (currently upgraded)
[*] 6261 (recently upgraded but discarded version)
[*] 4147 (currently replaced by newer version)

Versions we reproduced the problem with earlier:
[*] 2704
[*] 3325
[*] 3683

I posted this problem already 5 years ago, see: https://www.magpcss.org/ceforum/viewtopic.php?f=17&t=16664&start=10, including an opened bug: https://github.com/chromiumembedded/java-cef/issues/341
What happened since then:
[*] Bug was rejected as "won't fix" because problem was suspected to be a part of the JVM or on another place outside of JCEF
[*] Reject was accepted because customer didn't urge the problem
[*] We upgraded JCEF internally to version 6261, problem still persists
[*] Customer urged this problem
[*] Also a similar bug appeared: printing PDFs with opaque graphics (eg in diagrams) have the same printing problem (printed smaller and on the upper left of the page). Try sample PDF:
issue1.pdf
(642 Bytes) Downloaded 149 times

[*] In the meanwhile user salvadordf also reported this problem in the thread. He could reproduce it in CEF with cefclient.exe if I understood it right.
[*] Problem is also reproducable with chrome. We reproduced it with two environments: Released Chrome 64 bit and Development Chrome 32 bit. Both started with flag "--no-sandbox". Chrome showed a message that this flag is not supported and might not be stable.

How should we follow up on this?
Shall I report a bug on the CEF project?

//EDIT:
Bug resulted in a Bug report on the Chromium project: https://issues.chromium.org/issues/397013891
Attachments
svgRGBA.zip
(479 Bytes) Downloaded 483 times
Last edited by Phylanx on Mon Feb 17, 2025 4:28 am, edited 4 times in total.
Phylanx
Expert
 
Posts: 237
Joined: Thu Aug 11, 2016 8:17 am

Re: Printing HTML Elements with RGBA does not work

Postby KatrinaS » Sat Sep 14, 2024 7:37 pm

Possibly have a play with the CefPrintSettings returned in CefPrintHandler, maybe they're screwed up in JCEF,, like 'Background graphics',, but they (SVG vector icons) do appear (in Edge print preview at least) even if this option isn't selected :)
KatrinaS
Mentor
 
Posts: 87
Joined: Tue Jul 04, 2023 6:30 pm

Re: Printing HTML Elements with RGBA does not work

Postby Phylanx » Mon Sep 23, 2024 9:35 am

Well, we're providing JCEF in Windows and if I recall correctly the CefPrintHandler is only supported in Linux and never called in Windows.
Am I correct?

// EDIT:
Also: The "background graphics" are not "not printed" they are printed smaller and on the wrong position.
Phylanx
Expert
 
Posts: 237
Joined: Thu Aug 11, 2016 8:17 am

Re: Printing HTML Elements with RGBA does not work

Postby KatrinaS » Tue Sep 24, 2024 6:17 am

Oh right,, you'd have to give me a few hours before I can try your HTML and print your page out of muh JCEF? :)

Obviously I don't have the 'real' page you are attempting to print correctly but on first impressions of the svgRGBA.html page you supply, you aren't quite using the SVG tag correctly, it's a temperamental thing, here's an example of how I'd do it just using one icon as example :

Code: Select all
<svg xmlns="http://www.w3.org/2000/svg" style="display:none;">
<symbol id="green-plus" fill="currentColor" viewBox="0 0 16 16">
<path d="m8 1c-3.866 0-7 3.134-7 7 0 3.866 3.134 7 7 7 3.866 0 7-3.134 7-7 0-3.866-3.134-7-7-7m-.813 3h1.656v3.188h3.156v1.656h-3.156v3.156h-1.656v-3.156h-3.188v-1.656h3.188v-3.188"></path>
</symbol>
<!-- Any number of Icons you like -->
</svg>
Graphic (+) working: <svg width="20" height="20" style="color:rgba(23,124,28,0.95);"><use href="#green-plus"</use></svg>


You'll have to excuse it if it doesn't quite work for you but I copied it out of another (my) page and adapted, it's basically the gist of it anyway :D Using your way the style information you supply might not set the size of the icon and yes it appears 'top' of the line-height (or similar) like in your supplied page. You could just use a CSS class to set wotevs. Hope this goes some way to explaining certain layout issues :)
KatrinaS
Mentor
 
Posts: 87
Joined: Tue Jul 04, 2023 6:30 pm

Re: Printing HTML Elements with RGBA does not work

Postby Phylanx » Wed Sep 25, 2024 1:17 am

If I had the HTML in my hand then I would do this willingly and would happy with it :D

My problem is that we have this bug when we present the page of a third party.
And that JCEF displays it correctly but only prints it wrong.

The HTML I provided just shows the core problem without me having to show real world (and information security relevant) data.
Phylanx
Expert
 
Posts: 237
Joined: Thu Aug 11, 2016 8:17 am

Re: Printing HTML Elements with RGBA does not work

Postby Phylanx » Mon Oct 14, 2024 1:39 am

In the meanwhile also a CEF4Delphi user reported problems with this (as mentioned of salvadordf).
So I guess the "JVM globally configuring something" might not be the problem (or the Delphi environment does the same).

We will start with investigating this bug next month but we don't have a clue where to start.

Can someone point me to a good direction?
Phylanx
Expert
 
Posts: 237
Joined: Thu Aug 11, 2016 8:17 am

Re: Printing HTML Elements with RGBA does not work

Postby Phylanx » Mon Feb 10, 2025 2:41 am

Well, many other stuff happened in the meanwhile, we upgraded to 6723, the problem persists.
Also a customer reported a PDF with graphics where parts of it is printed the same way (diagram with shades under the curves where the shade is smaller and misplaced on the upper left of the page).

Can anybody give us a starting point where to look at?
Phylanx
Expert
 
Posts: 237
Joined: Thu Aug 11, 2016 8:17 am

Re: Printing HTML Elements with RGBA does not work

Postby Phylanx » Tue Feb 11, 2025 6:02 am

I created a new bug for this, see https://github.com/chromiumembedded/java-cef/issues/499

salvadordf also found out that this problem reproduces with cefclient.exe if "--no-sandbox" is passed as argument.

Any suggestions on how to proceed with this information?
Phylanx
Expert
 
Posts: 237
Joined: Thu Aug 11, 2016 8:17 am

Re: Printing HTML Elements with RGBA does not work

Postby Phylanx » Mon Feb 17, 2025 2:33 am

Documentation in threads starting post:

Could reproduce the problem in chrome too using flag "--no-sandbox"
Phylanx
Expert
 
Posts: 237
Joined: Thu Aug 11, 2016 8:17 am

Re: Printing HTML Elements with RGBA does not work

Postby Phylanx » Mon Feb 17, 2025 3:46 am

As the problem also reproduces in Chrome/Chromium I'll create a bug in Chrome for it.
Colleague salvadordf also did that some time ago for another problem with the "--no-sandbox" flag (problem that a subprocess didn't terminate):

https://issues.chromium.org/issues/40256384

I'll create a bug similar to that one.
This is the result: https://issues.chromium.org/issues/397013891
Phylanx
Expert
 
Posts: 237
Joined: Thu Aug 11, 2016 8:17 am


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 60 guests