Page 1 of 2

Enable Kiosk-Printing Mode in CEF

PostPosted: Tue Jan 13, 2015 4:41 am
by air
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

Re: Enable Kiosk-Printing Mode in CEF

PostPosted: Tue Jan 13, 2015 11:38 am
by magreenblatt
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.

Re: Enable Kiosk-Printing Mode in CEF

PostPosted: Thu Jan 15, 2015 1:06 am
by air
Thanks, that seems to much like "work-in-progess though". Found a workaround with a 3rd Party Application to not show the windows dialogs.

Re: Enable Kiosk-Printing Mode in CEF

PostPosted: Thu Jan 15, 2015 6:09 am
by PolesApart
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.

Re: Enable Kiosk-Printing Mode in CEF

PostPosted: Fri Jan 30, 2015 7:14 pm
by basicuser
Air, what third party product did you find?

Re: Enable Kiosk-Printing Mode in CEF

PostPosted: Sat Jan 31, 2015 11:23 pm
by crast
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.

Re: Enable Kiosk-Printing Mode in CEF

PostPosted: Mon Feb 02, 2015 2:31 am
by crast
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;
}

Re: Enable Kiosk-Printing Mode in CEF

PostPosted: Mon Sep 07, 2015 6:37 am
by muaddib
Can you, please, give an updated code for the latest CEF build?

Re: Enable Kiosk-Printing Mode in CEF

PostPosted: Thu Sep 17, 2015 7:59 pm
by GyaoG
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!

Re: Enable Kiosk-Printing Mode in CEF

PostPosted: Fri Jan 08, 2021 4:27 pm
by akhudairy
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;
}