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

@develop-plugins/pdf-export

v0.0.1

Published

根据配置项导出相应的pdf文件。

Readme

PDF-Export

根据配置项导出相应的pdf文件。

安装

 # npm
 npm i @develop-plugins/pdf-export
 
 # yarn
 yarn add @develop-plugins/pdf-export
 
 # pnpm
 pnpm add @develop-plugins/pdf-export

示例

  1. 初始化

    import PdfExport from '@develop-plugins/pdf-export';
       
    const pdf = new PdfExport({
        padding: 20, // 页面边距,默认20
        showPageNumbers: true // 是否显示页码,默认显示
    });
  2. 生成文本

    const textList = [
        {  position: 'center', text: '居中文本' },
        {  position: 'left', text: '默认居左文本' }
        {  position: 'right', text: '居右文本' }
        { text: '超长超长的文本' }
    ];
       
    /**
    * list列表元素属性
    * @param {string} text 文字
    * @param {'left'|'center'|'right'} [position='left'] 文本显示位置
    */
    pdf.generateTextList(list);

    ⚠️只支持一行显示一列文本,不支持一行显示多列。

  3. 生成表格

    // 表格列配置
    const columns = [
      { header: '姓名', dataKey: 'name' },
      { header: '备注', dataKey: 'remark' },
    ];
       
    // 表格行配置
    const body = [
      { name: '小李', remark: '表格行配置' },
      { name: '小张', remark: '表格行配置' }
    ];
       
    pdf.generateTable({
        body,
        columns,
        columnStyles: { remark: { cellWidth: 100 } },
    });

    更多表格样式配置参考:https://github.com/simonbengtsson/jsPDF-AutoTable/tree/master

  4. 生成图片

    /**
     * 生成图片
     * @param {string} imgUrl 图片链接
     * @param {'NONE'|'FAST'|'MEDIUM'|'SLOW'} [compression='NONE'] 图片压缩级别
     * NONE: 不进行压缩,保持原始质量。
     * FAST: 使用快速的压缩方式,压缩比较低。
     * MEDIUM: 使用中等压缩方式,压缩比较平衡。
     * SLOW: 使用慢速的压缩方式,压缩比较高。
     */
    pdf.generateImage(
        'https://images.pexels.com/photos/2049422/pexels-photo-2049422.jpeg?auto=compress&cs=tinysrgb&w=600'
      );

    如果导出文件时间过长,可以尝试调整compression的值。

  5. 保存PDF文件

    pdf.save('测试文档');

方法

| 名称 | 说明 | 参数 | | ---------------- | ---------------------- | ------------------ | | generateTextList | 通过列表生成对应的文本 | 查看示例代码配置项 | | generateTable | 通过配置生成对应的表格 | 查看示例代码配置项 | | generateImage | 生成图片 | 查看示例代码配置项 | | save | 保存PDF文件 | 查看示例代码配置项 |