0

I would download and view PDF files located in a folder on a server on an html page .

The problem is that when I perform :

Embed src = " D: \\ www \\ \\ xxx xxx xxx \\ \\ xxx.pdf " alt = " pdf " width = " 600 " height = " 700 ">

Google Chrome reads " Not allowed to load local resources " ..

Where does the problem come from and how resolve it ?

Thank you in advance.

4 Answers4

0

Google chrome has inbuilt functionality to read pdf files. You just have to redirect the user to the location of pdf using href and that's all, it will automatically load pdf. P.S. - There will also be an option to download pdf.

Prasheel
  • 985
  • 5
  • 22
0

You need to pass a server relative path for the file, like this:

<Embed src="http://10.0.0.1/files/xxx.pdf " alt="pdf" width="600px" height="700px"></Embed>

When 10.0.0.1 is your server IP, also, you can use a server name like http://myserver

You also can check this for more info Recommended way to embed PDF in HTML?

Community
  • 1
  • 1
  • When I put your solution, the server response with a status 404. But when I put an exterbal pdf file (For exemple a pdf file found on internet) it's work perfectly.. – Maxime Paillat Jun 22 '16 at 14:11
0

Are you trying to do this with code, or within HTML? Is this on a local network path, or are you trying to save it somewhere from an external site?

If you've put the PDFs where they belong (assuming network) and you want the user to be able to open it by clicking on a webpage link, write your tag out with something like: <embed src="D:\Thepath\ToYour\File.pdf width="600" height="700" type='application/pdf'> Web page Text here for your PDF </embed>

Also, it shouldn't be necessary to double-up on the backslashes, as HTML doesn't use escape characters this way (UNLESS it's actually happening in code from somewhere).

It may be worth looking into some of the responses from this article here, about whether to use an embed or object tag: Recommended way to embed a PDF in HTML

Community
  • 1
  • 1
Arthur Baczyk
  • 53
  • 1
  • 7
0

You and use ctrl+p on the html page in the google chrome browser and save that page as an .pdf

Dilip Nayak
  • 303
  • 2
  • 12