npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

image-pdf-preview

v1.0.6

Published

A Vue2 PDF preview component with zoom, navigation and thumbnail features.

Downloads

13

Readme

image-pdf-preview

A Vue2 PDF preview component with zoom, navigation and thumbnail features.

Installation

npm install image-pdf-preview

Usage

Global Registration

import Vue from 'vue'
import ImagePdfPreview from 'image-pdf-preview'
import 'image-pdf-preview/dist/image-pdf-preview.css'

Vue.use(ImagePdfPreview)

Component Registration

import Vue from 'vue'
import FilePreview from 'image-pdf-preview'
import 'image-pdf-preview/dist/image-pdf-preview.css'

Vue.component('FilePreview', FilePreview)

Template Usage

<template>
  <FilePreview 
    title="预览文件"
    :app-id="1"
    :vid="84148"
    @prev-page="handlePrevPage"
    @next-page="handleNextPage"
    @page-change="handlePageChange"
  />
</template>

<script>
export default {
  methods: {
    handlePrevPage(currentPage) {
      console.log('上一页,当前页:', currentPage + 1)
    },
    handleNextPage(currentPage) {
      console.log('下一页,当前页:', currentPage + 1)
    },
    handlePageChange(pageIndex) {
      console.log('页面切换,当前页:', pageIndex + 1)
    }
  }
}
</script>

Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | title | String | Yes | PDF文件标题 | | appId | Number | Yes | 应用ID | | vid | Number | Yes | 视频ID |

Events

| Event | Parameters | Description | |-------|------------|-------------| | prev-page | currentPage | 上一页事件 | | next-page | currentPage | 下一页事件 | | page-change | pageIndex | 页面切换事件 |

Methods

通过 $refs 可以调用组件的方法:

// 获取组件引用
const filePreview = this.$refs.filePreview;

// 调用方法
filePreview.prevPage();        // 上一页
filePreview.nextPage();        // 下一页
filePreview.goToPage(2);       // 跳转到第3页
filePreview.getCurrentPage();  // 获取当前页
filePreview.getTotalPages();   // 获取总页数

TypeScript Support

本组件已包含TypeScript类型定义,无需额外安装类型包。

import FilePreview from 'image-pdf-preview';

// 组件会自动提供类型提示
const component: typeof FilePreview = FilePreview;

Dependencies

  • Vue 2.6.0+
  • Element UI 2.15.0+

Features

  • 📄 PDF页面预览
  • 🔍 缩放功能(放大/缩小)
  • 📖 页面导航(上一页/下一页)
  • 🖼️ 缩略图导航
  • 📱 响应式设计
  • 🎯 TypeScript支持
  • 🔌 插件化安装