Page 1 of 1

Loading PDF from local file is blocked ?

PostPosted: Mon May 20, 2019 7:22 am
by Adriaanse
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 ?

Re: Loading PDF from local file is blocked ?

PostPosted: Mon May 20, 2019 9:56 am
by magreenblatt

Re: Loading PDF from local file is blocked ?

PostPosted: Mon May 20, 2019 10:32 am
by Adriaanse


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.

Re: Loading PDF from local file is blocked ?

PostPosted: Mon May 20, 2019 10:58 am
by magreenblatt
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

Re: Loading PDF from local file is blocked ?

PostPosted: Mon May 20, 2019 12:37 pm
by Adriaanse
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...

Re: Loading PDF from local file is blocked ?

PostPosted: Fri Nov 22, 2019 7:38 am
by Adriaanse
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 !