一键导入
Process PDF files - extract text, create PDFs, merge documents. Use when user asks to read PDF, create PDF, or work with PDF files.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Process PDF files - extract text, create PDFs, merge documents. Use when user asks to read PDF, create PDF, or work with PDF files.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Perform thorough code reviews with security, performance, and maintainability analysis. Use when user asks to review code, check for bugs, or audit a codebase.
Build MCP (Model Context Protocol) servers that give Claude new capabilities. Use when user wants to create an MCP server, add tools to Claude, or integrate external services.
| name | |
| description | Process PDF files - extract text, create PDFs, merge documents. Use when user asks to read PDF, create PDF, or work with PDF files. |
You now have expertise in PDF manipulation. Follow these workflows:
Option 1: Quick text extraction (preferred)
# Using pdftotext (poppler-utils)
pdftotext input.pdf - # Output to stdout
pdftotext input.pdf output.txt # Output to file
# If pdftotext not available, try:
npx tsx -e "import { readFile } from 'node:fs/promises'; import pdf from 'pdf-parse'; const data = await pdf(await readFile('input.pdf')); console.log(data.text);"
Option 2: Page-by-page with metadata
import { readFile } from "node:fs/promises";
import pdf from "pdf-parse";
const data = await pdf(await readFile("input.pdf"));
console.log(`Pages: ${data.numpages}`);
console.log(`Metadata: ${JSON.stringify(data.info)}`);
console.log(data.text);
Option 1: From Markdown (recommended)
# Using pandoc
pandoc input.md -o output.pdf
# With custom styling
pandoc input.md -o output.pdf --pdf-engine=xelatex -V geometry:margin=1in
Option 2: Programmatically
import { writeFile } from "node:fs/promises";
import { PDFDocument, StandardFonts } from "pdf-lib";
const doc = await PDFDocument.create();
const page = doc.addPage([612, 792]);
const font = await doc.embedFont(StandardFonts.Helvetica);
page.drawText("Hello, PDF!", { x: 100, y: 750, size: 12, font });
await writeFile("output.pdf", await doc.save());
Option 3: From HTML
# Using wkhtmltopdf
wkhtmltopdf input.html output.pdf
# Or with Playwright
npx playwright pdf input.html output.pdf
import { readFile, writeFile } from "node:fs/promises";
import { PDFDocument } from "pdf-lib";
const merged = await PDFDocument.create();
for (const path of ["file1.pdf", "file2.pdf", "file3.pdf"]) {
const source = await PDFDocument.load(await readFile(path));
const pages = await merged.copyPages(source, source.getPageIndices());
pages.forEach((page) => merged.addPage(page));
}
await writeFile("merged.pdf", await merged.save());
import { readFile, writeFile } from "node:fs/promises";
import { PDFDocument } from "pdf-lib";
const source = await PDFDocument.load(await readFile("input.pdf"));
for (const index of source.getPageIndices()) {
const single = await PDFDocument.create();
const [page] = await single.copyPages(source, [index]);
single.addPage(page);
await writeFile(`page_${index + 1}.pdf`, await single.save());
}
| Task | Library | Install |
|---|---|---|
| Read text | pdf-parse | npm install pdf-parse |
| Read/Write/Merge | pdf-lib | npm install pdf-lib |
| HTML to PDF | Playwright or wkhtmltopdf | npm install playwright / brew install wkhtmltopdf |
| Text extraction | pdftotext | brew install poppler / apt install poppler-utils |
ocrmypdf or tesseract if text extraction returns empty