Radio Buttons not printed correctly

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

Radio Buttons not printed correctly

Postby Phylanx » Fri Mar 29, 2019 3:48 am

Hi!

One of our customers has reported a strange behavior when printing a HTML site containing some radio buttons:
All non radio button content is printed correctly, but the radio buttons are missing.
Instead on the upper left part of the page some dots are printed that are not part of the HTML.
It seems that the missing radio buttons are printed smaller and on the wrong place (as if only the radio buttons are rendered with another shrink factor or something like that).

I extracted a HTML file to reproduce the problem easier and after some research we see the following facts:

The print works as expected in all current browsers (current versions of Chrome, Firefox, Chromium; did not test IE and Edge; see printResults attachments).
The print does not work in following JCEF versions (tested in detailed test program):
[*] 3.2704 (used in customer environment)
[*] 3.3325 (currently our development version)
[*] 3.3683 (latest jcef version)

As far as I have analyzed for now:
radio button printing itself works, I could test it with an easy HTML form containing radio input fields by myself.

the problematic radio buttons have a css class behind, unfortunatly I don't have access to all involved files.
On the other hand the problem is reproducable with a standalone HTML without having the other CSS files available.
Are there any problems regarding css and HTML printing known in JCEF so far?
A quick search in the forums didn't bring any results.

All relevant files are attached (problematic HTML in radioButtonsTest.zip), Screenshots of the printing results (used Microsoft Print to PDF, but result of pdf print is identical to physical prints) in printResults.zip.
Our environment:
Several Windows machines on versions 10, 8, 7.
JCEF is used in 32bit mode.
Attachments
printResults.zip
(134.59 KiB) Downloaded 786 times
radioButtonsTest.zip
(35.46 KiB) Downloaded 760 times
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Radio Buttons not printed correctly

Postby Phylanx » Mon Apr 01, 2019 7:35 am

New analysis results:
Besides poor HTML with several "input" tags that are never closed, theres something else interresting:

Every used Radio button consists of following elements:
Code: Select all
<div class="u-text-no-break u-pos-inline-block">
    <input onclick="filterAnamnesis('14orLess','HIDE_COLOR','green;yellow')" value="14orLess" id="valuesMap(filters)" name="valuesMap(filters)" class="radio radio2 js-done-radio" type="radio">
    <div class="awr-radio js-done-radio radio2" value="14orLess"></div>
    <label for="valuesMapId_filters_14orLess" class="radiolabel">Bis 14 Std.</label>
</div>


After trying around I found out following:
the "input" with type radio is not visible, so the default radio button is not shown.
The shown radio button is the second elemnt (the "div"). I guess in the CSS somehow it is implemented that clicking that sets the value of the "input" radio button.

For now that's all I can do, I have work on higher priorities now and I'm not sure when I can work on this again.
So if anybody has similar problems, a solution or knows anything about this problem in here, please feel free to post.
Attachments
1_rbTest.mod.html.zip
(44.82 KiB) Downloaded 772 times
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Radio Buttons not printed correctly

Postby magreenblatt » Mon Apr 01, 2019 4:28 pm

How does it behave in the cefclient sample application?
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: Radio Buttons not printed correctly

Postby Phylanx » Thu Apr 04, 2019 1:32 am

The answer is as interesting as unexpected.

I tested printing with cefclient.exe in versions 3.2704 and 3.3325.
Results: It works!

I attached the resulting PDF of version 3.2704, version 3.3325 produces the same result.

What is the difference in printing with JCEF and CEF?
Is there a PrintHandler implementation missing in the JCEF Demo apps that the cefClient sample has implemented?
Attachments
testPrint_cefClient2704.pdf
(785.17 KiB) Downloaded 753 times
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Radio Buttons not printed correctly

Postby ndesktop » Thu Apr 04, 2019 6:18 am

It might be the other way around, cefclient not implementing a print handler and JCEF implements a buggy one.
AFAIK, the default cefclient implementation returns a print handler for GTK and NULL for the other platforms.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: Radio Buttons not printed correctly

Postby Phylanx » Fri Apr 05, 2019 12:32 am

So it might be the same problem as with printing with CEF/JCEF on windows in general.
starting with support of the custom chromium print dialog, usage of print settings,...

Meaning this issue: " Adding Print Options to Cef3 " (https://bitbucket.org/chromiumembedded/ ... t-33266531)
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Radio Buttons not printed correctly

Postby magreenblatt » Fri Apr 05, 2019 9:37 am

There should be no difference in printing between CEF and JCEF. Does JCEF have all of the same pak files next to libcef.dll?
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: Radio Buttons not printed correctly

Postby Phylanx » Mon Apr 08, 2019 1:30 am

I have again tested cefsimple.exe and tests.detailed.MainFrame (version 3.3325) with printing (using the "Microsoft Print to PDF" printer) the attached HTML file and can reproduce following:

Detailed MainFrame reproduces the problem.
CefSimple does not.

In the test I used the same CEF binaries, the only things we adopted on JCEF side are:
[*] Enabling PDF support (commenting the "disable-extensions" line in client_app.cpp)
[*] We manually applied the patch for reparenting
[*] In CefBrowserWr.java: Added a boolean flag for preventing the browser to initialize if it has already been closed

All of our other changes are done in CEF code, so would influence both CEF and JCEF.

// EDIT:
Also tested following:
Downloaded newest cefClient image from download repository (3683) and tested printing.
Result: This printing worked!

Also built JCEF with newest version (3683) and retested with detailed.MainFrame.
Result: This printing printed NOTHING. The result was an empty PDF (0 bytes).
What's interesting: The "File -> Print to PDF" menu item generates a correct PDF.

Retested the usecase with 3325 detailed MainFrame:
"File->Print..." reproduces the problematic behavior (Radio buttons printed smaller and somewhere else)
"File->Print to PDF" Prints correctly.

What is the difference in rendering the page for "Print to PDF" and "real" print?
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Radio Buttons not printed correctly

Postby Phylanx » Wed Jul 10, 2019 4:25 am

After some time I could finally again have an eye on this topic.

I could isolate the problem to a CSS class property.
In our not correctly printed "div" RadioButtons or "div" SVG Graphics we have no opacity set.
In the correctly printed "div" Checkboxes the opacity of the computed CSS classes is set to "0.5".

If I set the opacity of the RadioButtons and SVG Graphics to "0.5" or "0.999", they are printed as expected.
Does anybody have suggestions what could influence this behavior?


As to other questions asked before:
I observed the behavior in the JCEF detailed MainFrame example application but not CEFs cefClient.exe.
Marshall asked following question:
There should be no difference in printing between CEF and JCEF. Does JCEF have all of the same pak files next to libcef.dll?

The Binaries used for the detailed.MainFrame and cefClient.exe are all situated in the same folder. So the *.pak Files should be the same.

I'll now have a look on ndesktop's suggestion:
It might be the other way around, cefclient not implementing a print handler and JCEF implements a buggy one.
AFAIK, the default cefclient implementation returns a print handler for GTK and NULL for the other platforms.
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: Radio Buttons not printed correctly

Postby ndesktop » Wed Jul 10, 2019 5:11 am

magreenblatt already said "There should be no difference in printing between CEF and JCEF".
(I was not aware *if* JCEF does something extra regarding print handler and looks like it does not).

"On the other hand the problem is reproducable with a standalone HTML without having the other CSS files available."
Well, in this case it should be reproducible also with cefclient or cefsimple as well.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Next

Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 14 guests