Enable Kiosk-Printing Mode in CEF

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Enable Kiosk-Printing Mode in CEF

Postby air » Tue Jan 13, 2015 4:41 am

Hi,

is it possible (and how) to activate the "kiosk" and "kiosk-printing" switches in an embedded CEF in Java? I would like to have the possiblilty of silent printing in an application, without the native Windows dialog popping up.

Thanks
air
Newbie
 
Posts: 9
Joined: Tue Jan 13, 2015 4:36 am

Re: Enable Kiosk-Printing Mode in CEF

Postby magreenblatt » Tue Jan 13, 2015 11:38 am

air wrote:is it possible (and how) to activate the "kiosk" and "kiosk-printing" switches in an embedded CEF in Java?

CEF does not support these flags.

air wrote:I would like to have the possiblilty of silent printing in an application, without the native Windows dialog popping up.

https://code.google.com/p/chromiumembed ... il?id=1478 will provide the ability to create a PDF file without showing a print dialog. You can then print the resulting PDF file in whatever way is most convenient for you.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Enable Kiosk-Printing Mode in CEF

Postby air » Thu Jan 15, 2015 1:06 am

Thanks, that seems to much like "work-in-progess though". Found a workaround with a 3rd Party Application to not show the windows dialogs.
air
Newbie
 
Posts: 9
Joined: Tue Jan 13, 2015 4:36 am

Re: Enable Kiosk-Printing Mode in CEF

Postby PolesApart » Thu Jan 15, 2015 6:09 am

I´m testing that patch and it works fine (at least on windows). If your kiosk solution will always send unchanged output to default printer then whatever you´re doing is probably the best solution. If you need to customize it from within cef you´ll probably need something else.
PolesApart
Mentor
 
Posts: 73
Joined: Fri Dec 05, 2014 1:24 pm

Re: Enable Kiosk-Printing Mode in CEF

Postby basicuser » Fri Jan 30, 2015 7:14 pm

Air, what third party product did you find?
basicuser
Newbie
 
Posts: 4
Joined: Fri Jan 30, 2015 10:18 am

Re: Enable Kiosk-Printing Mode in CEF

Postby crast » Sat Jan 31, 2015 11:23 pm

I added in file
src\printing\printing_context_system_dialog_win.cc
in function PrintingContextSytemDialogWin::ShowPrintDialog before return this lines:
options->Flags = PD_RETURNDEFAULT;
options->dwResultAction = PD_RESULTPRINT;

And rebuilded CEF. I checked it from remote desktop - prniter added document to print queue.
crast
Techie
 
Posts: 15
Joined: Tue Sep 23, 2014 2:30 am

Re: Enable Kiosk-Printing Mode in CEF

Postby crast » Mon Feb 02, 2015 2:31 am

UPD. Final version for kiosk-printing in windows.
Replace in file src\printing\printing_context_system_dialog_win.cc function ShowPrintDialog by this code:
Code: Select all
HRESULT PrintingContextSytemDialogWin::ShowPrintDialog(PRINTDLGEX* options) {

  base::MessageLoop::ScopedNestableTaskAllower allow(
      base::MessageLoop::current());

  options->Flags |= PD_RETURNDEFAULT;
  HRESULT result = PrintDlgEx(options);
  options->dwResultAction = PD_RESULT_PRINT;

  return result;
}
crast
Techie
 
Posts: 15
Joined: Tue Sep 23, 2014 2:30 am

Re: Enable Kiosk-Printing Mode in CEF

Postby muaddib » Mon Sep 07, 2015 6:37 am

Can you, please, give an updated code for the latest CEF build?
muaddib
Newbie
 
Posts: 1
Joined: Mon Sep 07, 2015 6:34 am

Re: Enable Kiosk-Printing Mode in CEF

Postby GyaoG » Thu Sep 17, 2015 7:59 pm

air wrote:Thanks, that seems to much like "work-in-progess though". Found a workaround with a 3rd Party Application to not show the windows dialogs.

I know you found a workaround with a 3rd Party Application to not show the windows dialogs,I wanto to know it,but I don't konw how do ,
you can help me? Thanks very much!
GyaoG
Mentor
 
Posts: 69
Joined: Mon Jul 20, 2015 9:56 am

Re: Enable Kiosk-Printing Mode in CEF

Postby akhudairy » Fri Jan 08, 2021 4:27 pm

muaddib wrote:Can you, please, give an updated code for the latest CEF build?


Well here is an answer just a little bit late ... well 6 years late :) ... I did the code as suggested by @crast. .. I think I just did minor changes. I am building branch 4147 cef 84.1.1

\code\chromium_git\chromium\src\printing\printing_context_system_dialog_win.cc

HRESULT PrintingContextSystemDialogWin::ShowPrintDialog(PRINTDLGEX* options) {
static bool is_dialog_shown = false;
if (is_dialog_shown)
return E_FAIL;
base::AutoReset<bool> auto_reset(&is_dialog_shown, true);

options->Flags |= PD_RETURNDEFAULT; // 0x00000400
HRESULT result = PrintDlgEx(options);
options->dwResultAction = PD_RESULT_PRINT; //0x1

return result;
}
akhudairy
Techie
 
Posts: 24
Joined: Wed Oct 21, 2020 7:35 am

Next

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 40 guests