0%

How to embed PDFs in your git page?

2 ways to embed PDFs in your git page. PDF hyperlink and embedded PDF.
  1. Put your file somewhere under the /source folder. For convenience, I created a folder for my PDFs and put my PDF file example.pdf under /source/pdfs.

  2. Calculate the relative location to /source folder for your PDF file. The relative location for example.pdf is /pdfs/example.pdf.

  3. Put an anchor to your PDF.

    1
    <a href="/pdfs/example.pdf">this</a>

    And it turns out like this.

  4. If you would like to open the PDF file in a new tab, simply add an attribute target='_blank'

    1
    <a href="/pdfs/example.pdf" target='_blank'>this</a>

    And it turns out like this.

  5. Instead of PDFs, you can locate other formats (images, videos, etc), using this method. But if your browser doesn't support the format, it prompt an file for you to download.

Embed PDF

Again, put the relative location into src attribute in the following code.

1
<embed src="/pdfs/example.pdf" width="90%" height="650px" />

It turns out like ...

Feel free to change the values of width and height.

BTW, if you cannot see the embedded PDF, sorry, your browser doesn't support this feature.