Loading PDF from local file is blocked ?

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

Loading PDF from local file is blocked ?

Postby Adriaanse » Mon May 20, 2019 7:22 am

Hi All,

Am i the only one having problems trying to load a PDF file from a local file ?

When I try to load a PDF document all is well if this is hosted on the web, accessed over https.

However, i cannot seem to open PDF files from the local file system, trying to load one directly using a file:/// url fails.

Also if i have a html file on my local file system i can open the html file using file:/// url but if this html file contains an anchor with relative url linking to a PDF file i still cannot open the PDF file, yet no messages are logged to the console to report the fact that the PDF file is being blocked ?

Using Chrome (executable) I can open the pdf file or the html file referring to it using a file:/// url but using JCEF I cannot, maybe there is an official statement by google somewhere that explains why ?
Adriaanse
Newbie
 
Posts: 9
Joined: Fri Nov 16, 2018 9:21 am

Re: Loading PDF from local file is blocked ?

Postby magreenblatt » Mon May 20, 2019 9:56 am

magreenblatt
Site Admin
 
Posts: 9831
Joined: Fri May 29, 2009 6:57 pm

Re: Loading PDF from local file is blocked ?

Postby Adriaanse » Mon May 20, 2019 10:32 am



Not quite, i cannot load a PDF from file:/// at all

Even in the sample apps included, if i try to open a PDF from file the result is a download prompt, i cannot get the PDF file to be rendered.
Adriaanse
Newbie
 
Posts: 9
Joined: Fri Nov 16, 2018 9:21 am

Re: Loading PDF from local file is blocked ?

Postby magreenblatt » Mon May 20, 2019 10:58 am

On Windows the client runs with --disable-extensions. You can remove that code from your local build: https://github.com/chromiumembedded/jav ... pp.cpp#L79
magreenblatt
Site Admin
 
Posts: 9831
Joined: Fri May 29, 2009 6:57 pm

Re: Loading PDF from local file is blocked ?

Postby Adriaanse » Mon May 20, 2019 12:37 pm

magreenblatt wrote:On Windows the client runs with --disable-extensions. You can remove that code from your local build: https://github.com/chromiumembedded/jav ... pp.cpp#L79


Thank you, that explains why for the client apps.

In our Java application we are doing nothing to disable extensions and for a PDF hosted on http / https viewing PDF works just fine, I have not been able to figure out why it is not working on file:/// yet...
Adriaanse
Newbie
 
Posts: 9
Joined: Fri Nov 16, 2018 9:21 am

Re: Loading PDF from local file is blocked ?

Postby Adriaanse » Fri Nov 22, 2019 7:38 am

just for the record;

I just tested this with a new build of the current (CEF version 78.2.7+g9cd8bac+chromium-78.0.3904.70) sources and the local PDF files (using a file:/// uri) now render just fine !
Adriaanse
Newbie
 
Posts: 9
Joined: Fri Nov 16, 2018 9:21 am


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 3 guests