0

There is web page, that has the "Print" button. I load it using DCEF3. If user clicks the button, the Printer selection dialog is shown. I want to disable printing once and for all. I have been trying to pass command line parameters using the example. So, I tried the following:

--disable-print-preview
--kiosk
--kiosk-printing

But none of them did the trick. Am I missing something?

Tom Brunberg
  • 20,312
  • 8
  • 37
  • 54
Edijs Kolesnikovičs
  • 1,627
  • 3
  • 18
  • 34

1 Answers1

1

CEF3 doesn't support "silent" printing, that is, printing without a printer selection dialog.

All you can do is :

  • Print to a temporal PDF file and then print the PDF file.
  • Take a snapshot from the browser and print the bitmap.
  • Modify the CEF3 libraries to hide the printer selection dialog.

These functions are much easier to use with CEF4Delphi or OldCEF4Delphi. To print in a PDF file all you have to do is call TChromium.PrintToPDF and to take a snapshot you need to call TChromium.TakeSnapshot

Not all the Chromium flags or command line switches are supported by CEF3. --kiosk and --kiosk-printing are not supported as you can see here.

You may even have to modify the JavaScript code in that web page to replace the "print" button function with a custom JavaScript extension registered with CEF3. That extension would send a message to the main browser process to print using your custom function.