简体   繁体   English

在带有html的本地文件夹中打开pdf文件以获取离线界面

[英]open a pdf file in local folder with html for offline interface

i am building an offline interface and want to show a pdf file when we click into a picture. 我正在建立一个离线界面,并希望在单击图片时显示pdf文件。 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

Which browser are you using? 您正在使用哪个浏览器? In Chrome your supplied html worked fine for me. 在Chrome中,您提供的html对我来说效果很好。 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. 有关的PDF实际上位于该目录中。
  • Your relative pathname is correct. 您的相对路径名正确。 Meaning that the folder attachments should be in the same folder as your html file. 这意味着文件夹attachments应与html文件位于同一文件夹中。
  • The PDF is valid, and is so for that browser. PDF是有效的,并且对于该浏览器也是如此。 Try opening it manually with the browser in question. 尝试使用相关的浏览器手动打开它。 (ie Open with... Chrome / Firefox / etc.) (例如,使用...打开Chrome / Firefox /等)

Also make sure that there isn't invalid html around this line. 还要确保此行周围没有无效的html。 That could possibly be causing your html to not work instead. 那可能导致您的html无法正常工作。

Good luck :) 祝好运 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM