Home > Web Front-end > JS Tutorial > Open pdf files using js plug-in (browser pdf plug-in sharing)

Open pdf files using js plug-in (browser pdf plug-in sharing)

PHPz
Release: 2018-09-30 17:51:50
Original
3174 people have browsed it

Requirement: To display pdf files in JSP web pages, two options are given below. The JS plug-in is good.

Two options: one is a direct link, treating the pdf file as an img file, similar In this form, link like this:

Another one: use js plug-in.

There are many js plug-ins for reading PDF files, such as: pdf.js: is a technical prototype mainly used to display PDF documents on the HTML5 platform without any local technical support; jsPDF: is a Javascript language An open source library for generating PDF (not supported by IE yet);

A relatively simple and easy-to-use js plug-in: PDFObject.js, which is a JavaScript library used to dynamically embed PDF documents in HTML.

The effect is as follows:

Open pdf files using js plug-in (browser pdf plug-in sharing)

PDFObject.js has been upgraded to 1.2 and can support IE9.

Purpose of PDFObject.js: Sometimes you need a little JavaScript. When you do, try PDFObject.

Let’s take a look at the very little js code:

OK, that's it. Just write the address correctly.

What should I do if I load pdf in a certain p? Looking at the official website, I found that the embed() method can have parameters. No parameters refer to the body, and parameters refer to a specific position.

Of course, you can also set further parameters, such as how many seconds you want to preview, with css, without css, etc.

The above is the entire content of this chapter. For more related tutorials, please visit JavaScript Video Tutorial!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template