0.1.1 • Published 10 months ago

@toystory/potato v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

PDF转HTML组件

基于Vue3.0构建,可将pdf转换为Canvas模式输出,支持缩放,旋转,局部放大镜等功能

安装

yarn add @toystory/potato -S
# OR
npm i @toystory/potato -S

基本使用方法

<template>
  <div class="pdf-container">
    <pdf-views url="/static/demo.pdf" scale rotate magnifyingGlass />
  </div>
</template>

<script setup lang="ts">
import pdfViews from '@toystory/potato'
import '@toystory/potato/dist/style.css'
</script>

单独使用放大镜

<template>
  <div class="pdf-container">
    <img ref="imgRef" src="/static/demo.jpg" />
  </div>
</template>

<script setup lang="ts">
import { MagnifyingGlass } from '@toystory/potato'
const imgRef = ref<HTMLImageElement | HTMLCanvasElement>()
new MagnifyingGlass({ el: pdfRef.value })
</script>

放大镜Options

参数类型描述
diffusionLengthnumber获取当前鼠标点的范围(放大范围,数值越小,放的越大)
viewSizenumber放大镜窗口的大小