Opening PDF in a browser with Github Pages

后端 未结 8 1708
面向向阳花
面向向阳花 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:40

    Place the PDF file in a folder like; www.website/pdf/example.pdf this will stop the file downloading outside of the root directory.

    The steps are:

    1. Create a new file in main directory.

    2. Name file /pdf/ and save it.

    3. Upload example.pdf file to this folder

    Result:: PDF is viewable at; www.website/pdf/example.pdf

    4. Optional step to avoid the .pdf URL. Create a index.html file in this folder and create a blank html file with PDF embed tag:

提交回复
热议问题