0

i am building an offline interface and want to show a pdf file when we click into a picture. But it does not work now. Please help me. This is my code

<a href="attachments/file.pdf"><img src="picture/nature.png" alt="pdffile"/></a>

Structure of directory

|--- file.htm
|----picture
| |--- nature.png
|----attachments
| |--- file.pdf

trangan
  • 341
  • 8
  • 22
  • 1
    Please explain `it does not work` – Justinas Jun 10 '16 at 11:07
  • I hope that will help you : http://stackoverflow.com/questions/291813/recommended-way-to-embed-pdf-in-html – raduken Jun 10 '16 at 11:09
  • @Justinas: it means when i click on picture, nothing happen, no file is showed. – trangan Jun 10 '16 at 11:13
  • @Raduken: thank you, i take a look already but my problem is different. I open pdf file from offline application, not from a website. Do you have any way to display the file in IE or foxit reader ? – trangan Jun 10 '16 at 12:15

1 Answers1

0

Which browser are you using? In Chrome your supplied html worked fine for me. Perhaps this could be to do with your directory structure.

I would make sure of the following:

  • The PDF in question is actually in that directory.
  • Your relative pathname is correct. Meaning that the folder attachments should be in the same folder as your html file.
  • The PDF is valid, and is so for that browser. Try opening it manually with the browser in question. (i.e. Open with... Chrome / Firefox / etc.)

Also make sure that there isn't invalid html around this line. That could possibly be causing your html to not work instead.

Good luck :)

Daniel Porteous
  • 5,536
  • 3
  • 25
  • 44
  • Thank you Daniel, I don't use any browser to open that pdf file. This file should be opened by foxit reader or adobe acrobat because this is an offline interface. I am using foxit reader and i want that it shows pdf file. – trangan Jun 10 '16 at 11:34
  • I'm fairly sure you can't make it open automatically in another, non-browser application directly by clicking the link. The pdf by default will open according to the browser defined behaviour, which will be either to open it natively (inside the browser) or download the file. Earlier browsers like IE let you open it but only following a dialog box. – Daniel Porteous Jun 10 '16 at 11:38
  • Could you help me with the code if it can be opened in browser or can be downloaded ? – trangan Jun 10 '16 at 11:41