Open pdf with native viewer?

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.

Open pdf with native viewer?

Postby robinm2 » Wed Feb 05, 2025 6:07 am

Is it possible to tell CEF to open PDF files with the preferred viewer from the OS instead of a CEF window?
I'm using cef 128.4.9 on Windows.
robinm2
Techie
 
Posts: 39
Joined: Mon Feb 08, 2021 12:14 pm

Re: Open pdf with native viewer?

Postby robinm2 » Thu Feb 13, 2025 1:52 pm

Update: I modified our OnDownloadUpdated callback to call ShellExecuteA on the file when the download is complete, if the user chose to open the file directly.
He can still click the popup at the top right corner and it will open the chrome viewer, but that's okay I guess.
robinm2
Techie
 
Posts: 39
Joined: Mon Feb 08, 2021 12:14 pm

Re: Open pdf with native viewer?

Postby magreenblatt » Thu Feb 13, 2025 2:13 pm

You can disable the built-in PDF viewer, and a download will be triggered by default. See https://support.google.com/chrome/threa ... ewer?hl=en
magreenblatt
Site Admin
 
Posts: 12949
Joined: Fri May 29, 2009 6:57 pm

Re: Open pdf with native viewer?

Postby robinm2 » Tue Feb 18, 2025 10:44 am

But how do you replicate those steps programmatically in CEF?
Anyway the current solution fits our needs. Thank you.
robinm2
Techie
 
Posts: 39
Joined: Mon Feb 08, 2021 12:14 pm

Re: Open pdf with native viewer?

Postby ndesktop » Tue Feb 18, 2025 1:09 pm

I think you can use plugins.always_open_pdf_externally preference.
Set this to true on startup. I did not tried this personally, but it should work.
ndesktop
Master
 
Posts: 883
Joined: Thu Dec 03, 2015 10:10 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 53 guests