Token导航 LogoToken导航TokenDH.com
前端设计操作浏览器github未标认证来源可访问许可证需确认审计通过

pdf-generatorPDF 生成器

Agent Skill

pdf-generator 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

12,314

周安装

305

GitHub Stars

3

下载量

2,284
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:pdf-generator(PDF 生成器)
来源仓库:https://github.com/jmsktm/claude-settings
仓库路径:skills/pdf-generator
安装命令:
npx skills add https://github.com/jmsktm/claude-settings --skill 'PDF Generator'
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/jmsktm/claude-settings --skill 'PDF Generator'

简介

pdf-generator 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。

  • 适用于生成项目文档、会议纪要或技术报告等正式输出材料。
  • 支持将文本、图表和链接整合为可打印或分享的 PDF 文件。
  • 安装命令:npx skills add https://github.com/jmsktm/claude-settings --skill 'PDF Generator'。
  • 注意检查是否涉及文件系统写入,防止意外覆盖重要文件。

SKILL.md

PDF Generator

The PDF Generator skill enables creation of professional PDF documents from various sources including Markdown, HTML, plain text, and structured data. It handles formatting, images, metadata, watermarks, and multi-page layouts. This skill leverages Node.js libraries like puppeteer, pdfkit, or jsPDF for comprehensive PDF generation capabilities.

Whether you need to convert documentation to PDF, generate reports with charts, create printable forms, or produce client deliverables, this skill provides the tools and workflows to create publication-quality PDFs programmatically.

Core Workflows

Workflow 1: Convert Markdown to PDF

Purpose: Transform Markdown files into formatted PDF documents with styling

Steps:

  1. Read the source Markdown file
  2. Parse Markdown to HTML using a library like marked
  3. Apply CSS styling for professional appearance
  4. Use Puppeteer to render HTML as PDF with proper page breaks
  5. Add metadata (title, author, creation date)
  6. Save to specified output path

Implementation:

const puppeteer = require('puppeteer');
const marked = require('marked');
const fs = require('fs');

async function markdownToPdf(mdPath, outputPath, options = {}) {
  const markdown = fs.readFileSync(mdPath, 'utf8');
  const html = marked.parse(markdown);

  const styledHtml = `
    <!DOCTYPE html>
    <html>
    <head>
      <style>
        body { font-family: 'Helvetica', sans-serif; margin: 40px; line-height: 1.6; }
        h1 { color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 10px; }
        h2 { color: #34495e; margin-top: 30px; }
        code { background: #f4f4f4; padding: 2px 6px; border-radius: 3px; }
        pre { background: #f4f4f4; padding: 15px; border-radius: 5px; overflow-x: auto; }
        blockquote { border-left: 4px solid #3498db; padding-left: 20px; color: #7f8c8d; }
      </style>
    </head>
    <body>${html}</body>
    </html>
  `;

  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.setContent(styledHtml);
  await page.pdf({
    path: outputPath,
    format: 'A4',
    margin: { top: '20mm', right: '20mm', bottom: '20mm', left: '20mm' },
    printBackground: true,
    ...options
  });
  await browser.close();
}

Workflow 2: Generate Multi-Page PDF Report

Purpose: Create structured reports with headers, footers, page numbers, and sections

Steps:

  1. Define report structure (cover page, TOC, sections, appendix)
  2. Create PDFKit document instance
  3. Add cover page with title, logo, date
  4. Generate table of contents with page references
  5. Add sections with consistent formatting
  6. Include headers and footers on each page
  7. Add page numbers and finalize

Implementation:

const PDFDocument = require('pdfkit');
const fs = require('fs');

function generateReport(data, outputPath) {
  const doc = new PDFDocument({
    size: 'A4',
    margins: { top: 50, bottom: 50, left: 50, right: 50 }
  });

  const stream = fs.createWriteStream(outputPath);
  doc.pipe(stream);

  // Cover page
  doc.fontSize(28)
     .text(data.title, { align: 'center' })
     .moveDown(2)
     .fontSize(14)
     .text(`Generated: ${new Date().toLocaleDateString()}`, { align: 'center' });

  doc.addPage();

  // Table of contents
  doc.fontSize(20).text('Table of Contents', { underline: true });
  doc.moveDown();
  data.sections.forEach((section, idx) => {
    doc.fontSize(12)
       .fillColor('blue')
       .text(`${idx + 1}. ${section.title}`, { link: `#section${idx}` })
       .fillColor('black');
  });

  // Sections
  data.sections.forEach((section, idx) => {
    doc.addPage();
    doc.fontSize(18)
       .fillColor('black')
       .text(section.title, { destination: `section${idx}` });
    doc.moveDown();
    doc.fontSize(11).text(section.content, { align: 'justify' });
  });

  // Add page numbers
  const pages = doc.bufferedPageRange();
  for (let i = 0; i < pages.count; i++) {
    doc.switchToPage(i);
    doc.fontSize(10)
       .text(`Page ${i + 1} of ${pages.count}`,
             50, doc.page.height - 50,
             { align: 'center' });
  }

  doc.end();
}

Workflow 3: Batch Convert HTML to PDF

Purpose: Convert multiple HTML files to PDFs in a single operation

Steps:

  1. Scan directory for HTML files or accept file list
  2. Set up Puppeteer browser instance (reuse for efficiency)
  3. For each HTML file:

- Load HTML content - Apply standard styling - Render to PDF with consistent settings - Save with corresponding filename

  1. Close browser and report results

Workflow 4: Add Watermark to Existing PDF

Purpose: Apply text or image watermarks to PDF documents

Steps:

  1. Load existing PDF using pdf-lib
  2. Get all pages
  3. For each page:

- Draw watermark text (diagonal, semi-transparent) - OR overlay watermark image

  1. Save modified PDF
  2. Preserve original metadata

Implementation:

const { PDFDocument, rgb, degrees } = require('pdf-lib');
const fs = require('fs');

async function addWatermark(inputPath, outputPath, watermarkText) {
  const existingPdfBytes = fs.readFileSync(inputPath);
  const pdfDoc = await PDFDocument.load(existingPdfBytes);
  const pages = pdfDoc.getPages();

  pages.forEach(page => {
    const { width, height } = page.getSize();
    page.drawText(watermarkText, {
      x: width / 2 - 100,
      y: height / 2,
      size: 48,
      color: rgb(0.75, 0.75, 0.75),
      opacity: 0.3,
      rotate: degrees(-45)
    });
  });

  const pdfBytes = await pdfDoc.save();
  fs.writeFileSync(outputPath, pdfBytes);
}

Workflow 5: Merge Multiple PDFs

Purpose: Combine multiple PDF documents into a single file

Steps:

  1. Create new PDF document
  2. Load each source PDF
  3. Copy all pages from each source
  4. Append to new document
  5. Save merged PDF with combined metadata

Quick Reference

ActionCommand/Trigger
Convert Markdown to PDF"convert [file.md] to pdf"
Generate report from data"create pdf report from [data]"
Batch convert HTML"convert all html files to pdf"
Add watermark"add watermark [text] to [file.pdf]"
Merge PDFs"merge [file1.pdf] and [file2.pdf]"
Extract pages"extract pages 1-5 from [file.pdf]"
Compress PDF"compress [file.pdf]"
Add metadata"set pdf metadata for [file.pdf]"

Best Practices

  • Page Sizing: Always specify format ('A4', 'Letter') and orientation for consistency
  • Margins: Use minimum 15mm margins for printability
  • Fonts: Embed fonts or use standard PDF fonts (Helvetica, Times, Courier) for compatibility
  • Images: Compress images before embedding to reduce file size
  • File Size: Monitor PDF size; use compression for files over 5MB
  • Accessibility: Include document structure tags for screen readers when possible
  • Metadata: Always set title, author, and creation date metadata
  • Page Breaks: Use CSS page-break-before or page-break-after for controlled pagination
  • Testing: Test PDFs in multiple viewers (Adobe, Preview, browsers)
  • Security: Offer password protection and permission settings for sensitive documents
  • Validation: Verify PDF/A compliance if archival quality is required
  • Batch Operations: Reuse browser instances when converting multiple files

Common Patterns

Documentation Export:

// Convert project README to PDF with styling
await markdownToPdf('./README.md', './docs/README.pdf', {
  headerTemplate: '<div style="font-size:10px; text-align:center;">Project Documentation</div>',
  footerTemplate: '<div style="font-size:10px; text-align:center;">Page <span class="pageNumber"></span></div>',
  displayHeaderFooter: true
});

Invoice Generation:

// Create PDF invoice from template
const doc = new PDFDocument();
doc.pipe(fs.createWriteStream('invoice.pdf'));
doc.fontSize(20).text('INVOICE', { align: 'center' });
doc.fontSize(12).text(`Invoice #: ${invoiceNumber}`);
doc.text(`Date: ${date}`);
// ... add line items, totals, etc.
doc.end();

Dependencies

Install required packages:

npm install puppeteer pdfkit pdf-lib marked

Error Handling

  • File Not Found: Verify source file paths before processing
  • Memory Issues: For large PDFs, use streaming and chunk processing
  • Font Errors: Fallback to standard fonts if custom fonts fail to load
  • Rendering Timeout: Increase Puppeteer timeout for complex pages
  • Permissions: Handle read/write permission errors gracefully

Performance Tips

  • Reuse Puppeteer browser instances for batch operations
  • Use PDF compression for files with many images
  • Cache rendered HTML for repeated conversions
  • Process large PDFs page-by-page rather than loading entirely into memory
  • Use worker threads for parallel PDF generation

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.07%
按下载量换算778

Claude

29.32%
按下载量换算670

Cursor

17.69%
按下载量换算404

Gemini CLI

9.22%
按下载量换算211

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills