chromiumembedded / cef

Chromium Embedded Framework (CEF). A simple framework for embedding Chromium-based browsers in other applications.
https://bitbucket.org/chromiumembedded/cef/
Other
3.38k stars 467 forks source link

cefsharp 126.2.7 disable-pdf-extension Invalid cefsharp 125.0.210 disable-pdf-extension normal #3739

Closed yyjj7788 closed 4 months ago

yyjj7788 commented 4 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen and what happened instead.

Screenshots If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

Additional context Does the problem reproduce with the cefclient or cefsimple sample application at the same version?

Does the problem reproduce with Google Chrome at the same version?

Add any other context about the problem here.

magreenblatt commented 4 months ago

The disable-pdf-extension flag is not supported with Chrome bootstrap.

chriscurtismozenda commented 3 months ago

Thank you for confirming @magreenblatt. Are there any plans to implement this behavior in the future for the Chrome bootstrap? Any suitable workarounds when using the Chrome bootstrap that you are aware of?

chriscurtismozenda commented 3 months ago

Looks like this setting is what is needed in Chrome: chrome://settings/content/pdfDocuments

If this is set to "Download PDFs" then the viewer is not invoked in a similar way and the PDFs go through the download manager. Is there a way to set this programmatically in CEF?

chriscurtismozenda commented 3 months ago

Looks like I was able to change this behavior with the following preference:

CfxValue pdfValue = CfxValue.Create();

pdfValue.SetBool(true);

bool success = this.Browser.Host.RequestContext.SetPreference("plugins.always_open_pdf_externally", pdfValue, out error);