Radio Buttons not printed correctly

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

Re: Radio Buttons not printed correctly

Postby Phylanx » Wed Jul 10, 2019 7:29 am

As mentioned in my previous posts:

I reduced the problem to a HTML file and 3 CSS files, all lying on my local disk.

The problem is reproducable using JCEFs detailed.MainFrame or simple.MainFrame application.
It is not reproducable using the cefClient.exe produced by the same build like libcef.dll.

All Binaries (libcef.dll, jcef.dll, jcef_helper.exe, *.pak,...) are used and lying in the same folder structure.

My environment:
Windows 10
JCEF/CEF 32 bit
Version 3325

Any ideas?
I'm willing to do the code search and fixing, but I have no clue where to start my search.
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Radio Buttons not printed correctly

Postby Czarek » Wed Jul 10, 2019 2:32 pm

How exactly are you printing in both jcef and cefclient when comparing? The "Print to PDF" feature calls CefBrowser::PrintToPDF with an argument CefPdfPrintSettings which allows you to set some print settings.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Radio Buttons not printed correctly

Postby Phylanx » Thu Jul 11, 2019 12:44 am

Hello, Czarek!
Here my reproduction use cases:

In detailed.MainFrame:
- Open detailed.MainFrame
- navigate to the html file (for example file://d:/mypath/rbTest.html)
- Menu File -> Print...
- For Tests I use the microsoft pdf printer, but printing on a physical printer brings the same results
- printing results are incorrect
- use Menu File -> Print to PDF
- printing results are correct! so that works.

cefclient:
- open cefclient.exe
- navigate to the html file (for example file://d:/mypath/rbTest.html)
- Menu Tests -> Print
- used same printer here
- printing results are correct
- Menu Tests -> Print to PDF
- printing results are correct

So the problem should be somewhere in the JCEF specific printing functionality if I am correct...
Can someone else reproduce that behavior?

// EDIT:
The problem also happens if I navigate to a http or https url, so file:// should not be the problem
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Radio Buttons not printed correctly

Postby Czarek » Thu Jul 11, 2019 1:49 am

Are you using the same revision of branch 3325 in JCEF and in cefclient? What if you copy just cefclient.exe (a single file) to your JCEF binaries and run it from there?

In both cases in JCEF and cefclient the "Print" feature calls CefBrowserHost::Print() method, so the results should be the same. Unless there are some extra settings being set in cefclient. Or maybe there are issues when loading resources, you can check it in Developer Tools console in your JCEF app.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Radio Buttons not printed correctly

Postby Phylanx » Thu Jul 11, 2019 2:14 am

Are you using the same revision of branch 3325 in JCEF and in cefclient? What if you copy just cefclient.exe (a single file) to your JCEF binaries and run it from there?

I copied the cefclient.exe in the same directory as jcef.dll/jcef_helper.exe and libcef.dll and also used it from there.
The used cefclient.exe comes from the same compile run as the libcef.dll.

jcef and cef binaries are from the same version (3325).
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Radio Buttons not printed correctly

Postby Phylanx » Thu Jul 11, 2019 8:31 am

After some fooling around with the CSS and HTML I could reduce the problem to the CSS "rgba()" function.
If you define this rgba() style without opacity you have the problematic printing behavior.
Adding the "opacity" style additionally fixes the problem.

Also tried using rgb() with opacity and it works correctly.

I attached a simple HTML showing three usecases with a SVG graphic:
  • usage of rgba without opacity (does not work)
  • usage of rgb with opacity (works)
  • usage of rgba with opacity (works)

For the reproduction you won't need any additional CSS files, the standalone HTML file is enough for that.
Any suggestions for that?
Is RGBA a special feature that has to be implemented/activated/deactivated?
Attachments
svgRGBA.zip
(479 Bytes) Downloaded 955 times
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Radio Buttons not printed correctly

Postby magreenblatt » Thu Jul 11, 2019 9:45 am

Phylanx wrote:Is RGBA a special feature that has to be implemented/activated/deactivated?

Not as far as I know. Also, 3325 is an old and unsupported branch. You should test with a supported version.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Radio Buttons not printed correctly

Postby Phylanx » Fri Jul 12, 2019 1:56 am

magreenblatt wrote:
Phylanx wrote:Is RGBA a special feature that has to be implemented/activated/deactivated?

Not as far as I know. Also, 3325 is an old and unsupported branch. You should test with a supported version.


As mentioned in my first post, I tested the bug with the newest version (3.3683) of that time.
A retest with the newest version today (3770) reproduced exactly the same behavior.

I couldn't see anything we did wrong, so I filed an issue for this:
https://bitbucket.org/chromiumembedded/ ... a-does-not
// UPDATED:
https://github.com/chromiumembedded/java-cef/issues/341

Where are the code places where I can start analysis?
Does anybody have an idea where the problem could be ?
Last edited by Phylanx on Wed Aug 16, 2023 1:20 am, edited 1 time in total.
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Radio Buttons not printed correctly

Postby salvadordf » Fri Aug 30, 2019 8:01 am

A CEF4Delphi user also reported this problem.

He tried to print some buttons and checkboxes but the borders were misplaced and they also had the wrong size.

After some tests I could finally reproduce this issue with the latest cefclient (CEF 76.1.12+gc6d4d85+chromium-76.0.3809.132) by adding the "--no-sandbox" command line switch.
You can see the results in the attached screenshot.

To test this I did the following :

That example has this HTML to print using JavaScript :
Code: Select all
<div>Hallo<input type="checkbox" id="cb" name="A1_1">
<button>Test Button</button>
<button onclick="window.print()">Print</button>
</div>


I used a fully updated Windows 10 64 bits.

The user who reported this issue was using a real printer and I only could reproduce it using the "Microsoft Print to PDF" printer. Other free PDF printers like "CutePDF Writer" and the internal "print to PDF" feature available in CEF work correctly.
Attachments
print-test.png
print-test.png (16.23 KiB) Viewed 20573 times
Maintainer of the CEF4Delphi, WebView4Delphi, WebUI4Delphi and WebUI4CSharp projects.
User avatar
salvadordf
Expert
 
Posts: 129
Joined: Sun Dec 18, 2016 8:39 am
Location: Spain

Re: Radio Buttons not printed correctly

Postby salvadordf » Sun Sep 01, 2019 1:26 pm

I tested this with the oldest cefclient build available at Spotify (CEF 3.2704.1414.g185cd6c) and it also draws the borders in the wrong position and size.

I just added an issue at Bitbucket :
https://bitbucket.org/chromiumembedded/ ... uttons-not
Maintainer of the CEF4Delphi, WebView4Delphi, WebUI4Delphi and WebUI4CSharp projects.
User avatar
salvadordf
Expert
 
Posts: 129
Joined: Sun Dec 18, 2016 8:39 am
Location: Spain

Previous

Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 14 guests

cron