🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@zys/pdf-reader

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zys/pdf-reader

pdf reader

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
2
Created
Source

@zys/pdf-reader

vue3 编写的 pdf 阅读器

安装

pnpm install @zys/pdf-reader

使用

<template>
    <div class='App abs-content'>
        <pdfReader :src="pdf"></pdfReader>
    </div>
</template>
<script setup lang="ts">
import "@zys/pdf-reader/style.css"
import pdfReader, { GlobalWorkerOptions } from "@zys/pdf-reader"
import workerUrl from "@zys/pdf-reader/pdf.worker.mjs?url"
import pdf from "./test1.pdf?url"
GlobalWorkerOptions.workerSrc = workerUrl
</script>
<style scoped lang="less">
.App {}
</style>

API

Props

属性名类型说明
srcstringpdf地址
verticalboolean是否垂直模式
fixedOutlineboolean是否固定大纲
swiperSwiperSwiperJs
swiperOptopnsSwiperJsOptionsSwiperJsOptions
outlineany[]大纲
numPagesnumber总页数
currentPagenumber当前页码
annotationsRecord<stringnumber, string
currentDrauuDrauu-
currentDrauuOptopnsCurrentDrauuOptopns-
containerHTMLDivElement-
showOutlineboolean是否显示大纲
isShowThumbnailListboolean是否显示缩略图
isOpenDrauuboolean是否开启批注
pdfPDFDocumentProxypdf文档代理或实例
thumbnailListsany[]缩略图列表
getThumbnailLists()=>any获取缩略图列表。默认不执行,还未实现
prevPage()=>void切换上一页
nextPage()=>void切换下一页
showToolsboolean是否显示地步操作工具页

Events

事件名说明
change当前页码生命周期回调

插槽

名称类型或参数说明
tool--

CurrentDrauuOptopns

属性名类型说明
mode'draw' 、 'stylus' 、 'line' 、 'rectangle' 、 'ellipse' 、 'eraseLine'模式
colornumber颜色
sizenumber粗细

功能

功能状态说明
缩放-
翻页-
横竖屏-
缩略图☑️待完善,按需加载
大纲-
批注-

批注功能

功能状态说明
清空-
撤回-
笔的粗细-
笔的模式-
是否开启批注默认开启

兼容性

  • 支持 IE11+
  • 支持移动端
  • 向下兼容到 chrome 87+ (已校验, 其他版本自行校验)

资料

  • pdf版本:pdfjs-dist(2.16.105)
  • 批注功能依赖:drauugithub
  • vueuse:13.0.0

Keywords

pdf

FAQs

Package last updated on 27 Mar 2025

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