Printer Settings

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

Printer Settings

Postby Phylanx » Tue Dec 01, 2020 5:22 am


I'm currently upgrading to JCEF version 4147 and adding the new and fancy print dialog supported by chrome ("--enable-print-preview").
Now I saw that if I set the setting "fit in page" when printing PDFs, the settings is remembered while the java.exe is running, but as soon as I start a new java.exe the setting is lost.

I already found following CEF Issue for something similar (should be already in my version as this issue handles the settings between different browsers in the same java process): ... e-not-kept

In another issue I found the setting "CefSettings.persist_user_preferences = true" which looks exactly like the thing I would need. ... omatically
I didn't find it in the Java CefSettings class or any command line switch.

Is it possible to set this flag in JCEF too?
And if not, is it possible to default enable "fit in page" if available?
Posts: 148
Joined: Thu Aug 11, 2016 8:17 am

Re: Printer Settings

Postby magreenblatt » Tue Dec 01, 2020 11:47 am

You're welcome to add CefSettings.persist_user_preferences to JCEF and submit a PR. You might want to test with cefclient first to verify that it provides the functionality that you're seeking.
Site Admin
Posts: 10939
Joined: Fri May 29, 2009 6:57 pm

Re: Printer Settings

Postby Phylanx » Wed Dec 02, 2020 1:34 am

I could add the functionality in JCEF, (either adding "--persist-user-preferences" to command line in java or the settings.persist_user_preferences = true; hard coded in context.cpp), the UserPrefs.json is written into the cache directory.
Unfortunatly there is no content in it and the setting is not working.
There is some json structure in it but it is not filled (only filled variable is the pref_version).
Renamed file (json extension is not allowed) is attached.

Is there something that I have to implement additionally?
(1.22 KiB) Downloaded 96 times
Posts: 148
Joined: Thu Aug 11, 2016 8:17 am

Re: Printer Settings

Postby ndesktop » Wed Dec 02, 2020 4:38 am

A good start would be something wired in AlloyBrowserMainParts::PostMainMessageLoopStart(), I suppose.
Posts: 558
Joined: Thu Dec 03, 2015 10:10 am

Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 5 guests