Use gitee to build pdf online reading function

1 Introduction

The pdf online reading function can store and organize your own small stock pdf, and can quickly browse, and link and cite in the writing article, which is also convenient for passers-by to download and watch.

2. Tools

  • Code Cloud Pages (gitee pages) is a free static web hosting service. In addition, you can also use gitee pages to host blogs, project official websites, etc. Later, we will use gitee pages to host pdf.js. Of course, github can also be implemented such an effect.
  • pdf.js is a javascript library that uses HTML5 Canvas to safely render pdf files and web browsers that comply with web standards to render pdf files. The plugin does not require any native support and has good browser compatibility.

3. Register gitee and create a repository

register gitee

run locally

$ ssh-keygen -t rsa -C '[email protected]'
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/XH/.ssh/id_rsa):
/c/Users/XH/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/XH/.ssh/id_rsa.
Your public key has been saved in /c/Users/XH/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:OY+Ek3Ww1gKxW0fC5bvbcQ2XlHT2kBaGb+YpPQn7qxM [email protected]
The key's randomart image is:
+---[RSA 3072]----+
|      ooo.o  .++o|
|       o.B  ..+o+|
|      . * =  o o.|
|       B = .. = .|
|      = S .  B.+.|
|       o + .E *+ |
|        . o .+...|
|           o.o.  |
|          . oo.. |
+----[SHA256]-----+


$ cat /c/Users/XH/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC6PcgwDYK//ZRdY48q8C1kKw7OsdGggUQff1GW/e3JE6RqWdIZN1Y
................................
pt9HhYq3f/ocvbnx0RHJcs1F82lYZZh7iLZwHhxV5L47pwHLs8YkJ5WM8PnRtOymS0JNuoaam+rXp5ORhY3+ATsk7bcNVA6eNLb2Z+IWKemdoSWs8Jt/XDthJ/B8Jp5z3kDmGsClZ0UHpsgPY/i2IrpXk= [email protected]

insert image description here

4. Initialize mimipdf library

Create an empty project mimipdf locally and initialize git

mkdir mimipdf
cd mimipdf
git init

Create a repository named mimipdf in gitee and connect to the remote repository locally

git config --global user.name "xxxxx"
git config --global user.email "[email protected]"
git remote add origin https://gitee.com/xxxx/mimipdf.git

Download the source code of pdf.js and extract it to the local Npdf repository.

XH@DESKTOP-2FKN21J MINGW64 /f/gitee/mimipdf (master)
$ ls pdfjs-2.13.216-dist/
build/  LICENSE  web/

Put the files you want to display pdfinto the web folder and upload the files to the gitee repository

5. Upload update content

git add *
git commit -m "add pdf.js"
git push origin master

6. Create Gitee Pages

In the gitee mimipdfrepository, select Enter under Service and Gitee Pages.select Create Pages.

insert image description here
Of course, you must have the conditions of real-name authentication

  • actual name
  • ID number
  • ID card front and back photos
  • holding ID card

insert image description here
When the authentication is passed, the following content can finally be generated (deployment is successful), just
insert image description here
click to start.

Access my pdf books:

https://ghostwritten.gitee.io/mimipdf/web/viewer.html?file=LexingtonClassAircraftCarrier.pdf

As shown in the online PDF:
insert image description here


insert image description here

Guess you like

Origin blog.csdn.net/xixihahalelehehe/article/details/123756337