Opening PDF in a browser with Github Pages

后端 未结 8 1720
面向向阳花
面向向阳花 2021-01-31 09:48

I am using GitHub Pages to host my website. I have a PDF file that I want visitors to be able to open directly in a browser. But when I upload the PDF file to GitHub Pages and l

8条回答
  •  臣服心动
    2021-01-31 10:23

    Suppose your personal website is hosted in a Github page as follows:

    https://username.github.io
    

    The repository should be name as username.github.io. If you have a pdf file named document.pdf and you place it in the directory folder then you should be able to open it directly in the browser through the following link:

    https://username.github.io/folder/document.pdf
    

    To allow the user to open the pdf in a new window in the browser, you may use the following HTML, where "PDF" points to the link:

    PDF.
    

提交回复
热议问题