Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我有一个github网页。如何使页面显示纯pdf格式?比如我的简历?_Github_Github Pages - Fatal编程技术网

我有一个github网页。如何使页面显示纯pdf格式?比如我的简历?

我有一个github网页。如何使页面显示纯pdf格式?比如我的简历?,github,github-pages,Github,Github Pages,我有一个github网页。如何使页面显示纯pdf格式?比如我的简历 为了澄清,我希望页面只填充pdf,而不是任何标题等。您可以在index.html中有一个JS重定向,指向您的github页面repo中的pdf文件 假设您的文件结构如下:- index.html - cv(folder) -----cv.pdf (your cv) 那么你的代码应该是这样的 <html> <body> </body> <script type="text/javasc

我有一个github网页。如何使页面显示纯pdf格式?比如我的简历


为了澄清,我希望页面只填充pdf,而不是任何标题等。

您可以在
index.html
中有一个JS重定向,指向您的github页面repo中的pdf文件

假设您的文件结构如下:-

index.html
- cv(folder)
-----cv.pdf (your cv)
那么你的代码应该是这样的

<html>
<body>

</body>
<script type="text/javascript">
    document.location = "robin.github.io/cv/cv.pdf"
</script>
</html>

document.location=“robin.github.io/cv/cv.pdf”

只要将您的pdf提交到您的回购协议中,它就可以像任何其他文件一样访问

例如,我的简历已提交至我的回购协议,并可在以下网址获得(我已为
changedmy.name
设置了CNAME)。

您也可以这样做:

<html lang="fr">
<head>
<!-- note the meta tag -->
<meta http-equiv="refresh" content="0; url=http://yourprofile.github.io/cv.pdf" />
  <meta charset="utf-8">
  <title>Will CV</title>
</head>
<body>
</body>
</html>

威尔简历

有关更多信息,请参阅。

您可以使用iframe或类似的工具嵌入PDF,而不是重定向到PDF

通过这种方式,可以在页面中访问PDF,并且您可以防止在未在浏览器中查看的情况下下载PDF


要使页面“纯粹”显示pdf是不可能的,要做到这一点,您需要更改响应标题,这显然是github页面不可能做到的。

github使用pdf.js显示pdf,例如,您可以找到带有URL的iframe,您可以使用它嵌入简历(例如)。

谢谢,robin。那么,我将把这个代码输入到哪个文件中呢?index.html文件?我已将cv2016.pdf上传到我的简历文件夹。在cv文件夹的索引文件中,我精确地输入了以下代码:document.location=“”,但它似乎不起作用,因为我得到了404页!有什么建议可以让这个工作吗?编辑我的答案。给我一点时间,Chrome有一个内置的PDF浏览器已经有一段时间了;Mozilla还没有将pdf.js与Firefox集成吗?使用其中一个或PDF查看插件,直接访问PDF url只会显示它,而不是强制下载。它发布下载,不呈现预览