As you know, the pdf file of the web page opened by Apple mobile phone can be opened by default, with a built-in reader, but Android cannot. You must use some js methods to achieve online preview, or you will be prompted to download directly, which is very unfriendly. Let's share a few simple steps to achieve online preview of pdf files on Android phones.
1) First, download some js packages. The download address is: Click here to arrive directly
2) Click Download to download the stable version
3) Introduced into the project:
<script src="js/build/pdf.js"></script> <script src="js/web/viewer.js"></script> <link rel="stylesheet" href="js/web/viewer.css">
4) Use, access by default js/web/
The pdf file in the directory. To open files in other places, use ../../ test.pdf
that will do
<a target="_blank" href="js/web/viewer. html? File=mypdf/test. pdf">Preview PDF files online</a>
Then you can preview the pdf directly~~~