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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vant-preview-pdf

v0.0.1

Published

基于pdfjs-dist2.3.200版本实现预览pdf文件,vant组件支持传入预览图片方法实现点击pdf预览图片

Downloads

4

Readme

vant-preview-pdf组件使用说明

安装

npm install -S vant-preview-pdf

准备工作

安装后找到如下文件夹

node_modules

vant-preview-pdf

cmaps

将cmaps文件夹上传服务器,使其可以使用链接访问

可放置在public文件夹下与index.html同级,使用项目链接访问该文件

引入

const vantPreviewPdf = require("vant-preview-pdf") 
Vue.use(vantPreviewPdf)

使用

<vant-preview-pdf cMapUrl="http://www.xiaobusoft.com/cmaps/" url="http://www.xiaobusoft.com/vant-preview-pdf.pdf" />

可配置参数

| 字段 | 说明 | 类型 | 默认值 | | :------------: | :----------------------------------------------------------: | :------: | :----------------------------------------------------: | | eid | canvas的Id | String | pdfjs | | base64Pdf | pdf base64数据流, 有无data:application/pdf;base64, 开头均可 | String | “” | | url | pdf 文件路径 base64Pdf优先级高于url 确保base64Pdf没配置 | String | “” | | limitHttp | pdf 限制url是否有http,结合url入参使用 | Boolean | true | | imagePreviewFn | vant的imagePreview方法 | Function | 空 | | autoScroll | 图片预览关闭,自动滚动到对于索引位置 | Boolean | true | | cMapUrl | cMaps 文件夹访问地址 地址 记得 “/” 结尾 | String | https://cdn.jsdelivr.net/npm/[email protected]/cmaps/ |

事件

| 方法 | 描述 | | :-----------------: | :-----------------------------------: | | savePreviewImageFn | 向外传递pdf预览图片 | | previewImageOnClose | 关闭预览,抛出对应位置图片 | | renderPdfError | pdf渲染失败异常抛出 | | renderPdfFinally | pdf渲染完成事件,可在此时关闭加载动画 |