You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

vue-pdf-search-viewer

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-pdf-search-viewer

Pdf viewer base on Vue.js and Pdf.js, support pdf view, search by keyword and change page

0.2.4
latest
Source
npmnpm
Version published
Weekly downloads
63
65.79%
Maintainers
2
Weekly downloads
 
Created
Source

vue-pdf-search-viewer

Pdf viewer base on Vue.js and Pdf.js, support pdf view, search by keyword and change page.

Step1 Install

npm install --save vue-pdf-search-viewer

Step2 Config webpack or vue.config(below is vue.config)

//vue.config.js

module.exports = {
   chainWebpack: config => {
   
    //...your configs
    
    config
      .plugin('copy')
      .tap(args => {
        args[0].push(
          {
            context: 'node_modules/vue-pdf-search-viewer/lib/',
            from: '*.umd.min.*.js',
            to: 'js/',
            toType: 'dir'
          },
          {
            from: 'node_modules/vue-pdf-search-viewer/lib/pdf.worker.js',
            to: 'pdf.worker.js',
            toType: 'file'
          },
        )
        return args
      })
  }
}

Step3 Import and register

//main.js

import PdfViewer from 'vue-pdf-search-viewer'

Vue.use(PdfViewer)

Example

<template>
  <pdf-viewer src="./compressed.tracemonkey-pldi-09.pdf"></<pdf-viewer>
</template>
 

API

PropsTypeDescription
srcstring or other(detail to see pdf.js getDocument())Pdf url
autoWidthboolean, default falseWhether to zoom pdf to container width when initial
EventsParametersDescription
on-loadednumberPdf total page number
on-searchobject: { current, total }Search keyword matched current number and total count
on-page-changenumberCurrent page number
MethodsParametersDescription
searchstringSearch keyword in pdf
searchAgainparam1:string, param2: booleanParam1 is search keyword, param2 is dicided to find pre(true) or find next(false)
cancelSearchnoneCancel search
zoomnumber/ string('auto')Number: The ratio of pdf zoom, 'auto': zoom to container width
jumpToPagenumberThe page number of pdf jumped to

Keywords

vue

FAQs

Package last updated on 14 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts