Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问许可证需确认审计通过

pdf-toolkitPDF toolkit 文档

Agent Skill

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

总安装

329

周安装

14

GitHub Stars

4

下载量

115
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/accolver/skill-maker --skill pdf-toolkit

简介

pdf-toolkit 用于提取、创建和操作 PDF 文档,支持文本、表格、图像和 OCR 处理。

  • 适用于需要从 PDF 生成结构化数据或创建 PDF 文件的自动化任务。
  • 通过 Bun TypeScript 脚本执行操作,输出为 JSON 格式结果。
  • 安装命令:npx skills add https://github.com/accolver/skill-maker --skill pdf-toolkit。
  • 注意权限范围和维护状态,避免对非 PDF 文件进行误操作。

SKILL.md

PDF Toolkit

Extract data from PDFs (text, tables, images, OCR), create new PDFs, and manipulate existing ones (merge, split). All operations use bundled Bun TypeScript scripts that produce structured JSON output.

When to use

  • The task explicitly involves PDF extraction, OCR, creation, merging, splitting, or conversion using the bundled scripts.
  • The user needs machine-processable output from PDF documents or wants to generate PDF artifacts.
  • The request is document-processing work on .pdf inputs or outputs, not general office-file editing.
  • The workflow should run through the toolkit’s existing Bun/TypeScript utilities.

Do NOT use when:

  • The files are primarily DOCX, XLSX, PPTX, or another non-PDF format.
  • The task requires interactive AcroForm filling, digital signing, or PDF encryption features the toolkit does not cover.
  • The request is general OCR with no PDF input or output requirement.

Response format

Always structure the final response with these top-level sections, in this order:

  1. Summary — state the task, scope, and main conclusion in 1-3 sentences.
  2. Decision / Approach — state the key classification, assumptions, or chosen path.
  3. Artifacts — provide the primary deliverable(s) for this skill. Use clear subheadings for multiple files, commands, JSON payloads, queries, or documents.
  4. Validation — state checks performed, important risks, caveats, or unresolved questions.
  5. Next steps — list concrete follow-up actions, or write None if nothing remains.

Rules:

  • Do not omit a section; write None when a section does not apply.
  • If files are produced, list each file path under Artifacts before its contents.
  • If commands, JSON, SQL, YAML, or code are produced, put each artifact in fenced code blocks with the correct language tag when possible.
  • Keep section names exactly as written above so output stays predictable across skills.

Workflow

1. Identify the operation

Determine which script to use based on what the user needs:

NeedScript
Extract text from PDFscripts/extract-text.ts
Extract tables as structured datascripts/extract-tables.ts
Extract images from PDFscripts/extract-images.ts
OCR a scanned/image-based PDFscripts/ocr-pdf.ts
Create a new PDFscripts/create-pdf.ts
Merge multiple PDFsscripts/merge-pdf.ts
Split a PDF into partsscripts/split-pdf.ts

How to choose between extract-text and ocr-pdf: If the PDF contains selectable text (you can copy-paste from it), use extract-text.ts. If the PDF is a scan or image (text is embedded in images), use ocr-pdf.ts. When unsure, try extract-text.ts first — if it returns empty or garbled text, fall back to ocr-pdf.ts.

2. Run the script

All scripts follow the same conventions:

bun run scripts/<script>.ts [options] <input-file>
  • JSON output goes to stdout (parseable by agents)
  • Progress and diagnostics go to stderr
  • Exit code 0 = success, 1 = error
  • All scripts support --help for full usage

3. Process the output

Parse the JSON output for downstream use. All scripts return structured JSON with consistent patterns (file metadata, page-level results, summary counts).

Script Reference

extract-text.ts — Text extraction

# All text from a PDF
bun run scripts/extract-text.ts document.pdf

# Specific pages as JSON
bun run scripts/extract-text.ts --pages 1,3,5-7 --format json report.pdf

# Per-page text to a file
bun run scripts/extract-text.ts --per-page --output out.txt slides.pdf
FlagDefaultDescription
--pagesallPage selection (e.g., 1,3,5-7)
--formattextOutput format: text or json
--per-pageoffSeparate output by page
--outputstdoutOutput file path

Uses unpdf for text extraction. Works with PDFs that have embedded text layers. For scanned PDFs, use ocr-pdf.ts instead.

extract-tables.ts — Table extraction

# Extract all tables as JSON
bun run scripts/extract-tables.ts report.pdf

# Extract tables from specific pages as CSV
bun run scripts/extract-tables.ts --pages 2,3 --format csv data.pdf
FlagDefaultDescription
--pagesallPage selection
--formatjsonOutput format: json, csv, or tsv
--outputstdoutOutput file path

Detects tables by delimiter patterns: tab-separated, pipe-separated (|), and multi-space-separated. Returns structured data with headers and rows.

extract-images.ts — Image extraction

# Extract all images as PNG
bun run scripts/extract-images.ts document.pdf

# Extract from pages 1-3 as JPEG, min 100px
bun run scripts/extract-images.ts --pages 1-3 --format jpeg --min-size 100 brochure.pdf

# List images without saving
bun run scripts/extract-images.ts --list-only slides.pdf
FlagDefaultDescription
--pagesallPage selection
--output-dir./extracted-images/Where to save images
--formatpngImage format: png or jpeg
--min-size50Min dimension in pixels
--list-onlyoffList without saving

Uses mupdf WASM to extract image XObjects. Falls back to full-page rendering at 288 DPI when discrete images can't be extracted.

ocr-pdf.ts — OCR for scanned PDFs

# OCR a scanned PDF
bun run scripts/ocr-pdf.ts scanned-doc.pdf

# OCR specific pages in German at high DPI
bun run scripts/ocr-pdf.ts --pages 1-5 --lang deu --dpi 600 scan.pdf

# JSON output with confidence scores
bun run scripts/ocr-pdf.ts --format json --output result.json scanned.pdf
FlagDefaultDescription
--pagesallPage selection
--formattextOutput format: text or json
--langengTesseract language code
--dpi300Rendering DPI (higher = better OCR)
--confidence-threshold30Min word confidence (0-100)
--outputstdoutOutput file path

Renders pages via mupdf, then OCRs with tesseract.js. JSON output includes per-page confidence scores and low-confidence word lists. Common language codes: eng, fra, deu, spa, jpn, chi_sim.

create-pdf.ts — PDF creation

# From plain text
bun run scripts/create-pdf.ts --from-text input.txt --output out.pdf

# From images (one per page)
bun run scripts/create-pdf.ts --from-images "photos/*.png" --output album.pdf

# From markdown
bun run scripts/create-pdf.ts --from-markdown doc.md --output report.pdf --page-size a4
FlagDefaultDescription
--from-textCreate from plain text file
--from-imagesCreate from image files (glob pattern)
--from-markdownCreate from markdown file
--outputrequiredOutput PDF path
--page-sizeletterPage size: letter, a4, legal
--margin72Margin in points (72pt = 1 inch)
--font-size12Base font size in points
--titleDocument title metadata
--authorDocument author metadata

Exactly one of --from-text, --from-images, or --from-markdown must be specified. Uses pdf-lib for PDF generation.

merge-pdf.ts — Merge PDFs

# Merge two PDFs
bun run scripts/merge-pdf.ts --output merged.pdf chapter1.pdf chapter2.pdf

# Merge with page selections (semicolon-separated, one per input)
bun run scripts/merge-pdf.ts --output out.pdf --page-ranges "1-3;all;2-5" a.pdf b.pdf c.pdf
FlagDefaultDescription
--outputrequiredOutput PDF path
--page-rangesallPer-input page selections (;-separated)
--bookmarkoffAdd source filenames to metadata

Pass two or more input PDFs as positional arguments. They are merged in order. Page ranges use semicolons between inputs: "1-3;all;2-5" means pages 1-3 from the first PDF, all from the second, pages 2-5 from the third.

split-pdf.ts — Split PDF

# One file per page
bun run scripts/split-pdf.ts report.pdf

# Split into 5-page chunks
bun run scripts/split-pdf.ts report.pdf --mode chunks --chunk-size 5 --output-dir ./split/

# Split by custom ranges
bun run scripts/split-pdf.ts report.pdf --mode ranges --ranges "1-3;4-6;7-10"
FlagDefaultDescription
--modepagesSplit mode: pages, ranges, chunks
--output-dir.Output directory
--rangesPage ranges for ranges mode
--chunk-sizePages per chunk for chunks mode
--prefixinput nameFilename prefix for outputs

Checklist

  • Identified the correct script for the operation
  • Checked if PDF has selectable text (extract-text) or is scanned (ocr-pdf)
  • Used --format json when structured output is needed downstream
  • Verified output file exists and has expected content
  • For merges: inputs provided in correct order
  • For splits: verified all output files are present

Common Mistakes

MistakeFix
Using extract-text on a scanned PDFUse ocr-pdf.ts instead — extract-text returns empty
Forgetting --output on merge-pdf--output is required, not optional
Page ranges in merge use commas between inputsUse semicolons between inputs: "1-3;all;2-5"
OCR returns garbled textIncrease --dpi (try 600) or check --lang matches source
extract-images returns nothingIncrease --min-size or check pages have actual images
split in ranges mode without --ranges flag--ranges is required when --mode is ranges
Passing glob pattern unquoted to from-imagesQuote the glob: --from-images "*.png" not *.png

Key Principles

  1. Text before OCR — Always try extract-text.ts first. It's faster and more accurate for PDFs with embedded text. Only use ocr-pdf.ts when extract-text returns empty or garbled output.
  2. JSON for pipelines — Use --format json when the output will be processed by another script or the agent. Use --format text when the output is for human reading.
  3. Page ranges are 1-indexed — All scripts use 1-indexed page numbers in their --pages and --ranges flags. Internally they convert to 0-indexed for the PDF libraries.
  4. Stderr for progress, stdout for data — Never mix diagnostics with output. All scripts write progress to stderr and data to stdout.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

34.31%
按下载量换算39

Claude

31.51%
按下载量换算36

Cursor

18.7%
按下载量换算22

Gemini CLI

8.89%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

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

来源信息

继续浏览同类 Skills