Change default behavior for opening pdfs

Having problems with building or using the JCEF Java binding? Ask your questions here.

Change default behavior for opening pdfs

Postby edominic » Mon Mar 14, 2016 3:21 am

Hey guys,
a little question to you.

Is it possible to change the behavior of opening pdfs?

The default behavior is that the included pdf-plugin will be opened if I want to open a pdf. But I want something like a switch, that the user can decide if the pdf will be opened in pdf-plugin or it will be opened in native pdf reader (pdf reader from OS).

Is there any solution instead of removing pdf-plugin on start of cef?
edominic
Mentor
 
Posts: 82
Joined: Fri Mar 13, 2015 6:46 am

Re: Change default behavior for opening pdfs

Postby magreenblatt » Mon Mar 14, 2016 11:19 am

There is no external PDF plugin that works in Chromium currently. You would need to download the file and then have your application open it using some other PDF viewer. Assuming you're using a current version of CEF running with the `--disable-pdf-extension` command-line flag will cause PDFs to trigger a download.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Change default behavior for opening pdfs

Postby edominic » Mon Mar 14, 2016 2:19 pm

Too bad, but thanks for reply :)
edominic
Mentor
 
Posts: 82
Joined: Fri Mar 13, 2015 6:46 am

Re: Change default behavior for opening pdfs

Postby edominic » Tue Mar 15, 2016 5:57 am

I tried it, but it does not work correctly for me :/

If I set
Code: Select all
--disable-pdf-extension
to sample app, it works fine, but if I put it on my application, chromium is still loading pdf-plugin.

I already tried setting the arg directly to CefApp.getInstance :

Code: Select all
xyz = CefApp.getInstance(new String[]{"--disable-pdf-extension"}, new JCefSettings().getCefSettings());


command-line-args are not disabled in cefsettings.
The only setting I change is resources_dir_path (I need to for my application).

I don't know, what I should do now -.-"

Edit:

I am using latest jcef on macOs
edominic
Mentor
 
Posts: 82
Joined: Fri Mar 13, 2015 6:46 am


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 37 guests