用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/vamseeachanta/workspace-hub --skill pypdf-batch-pdf-processing-pipeline命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
Write outbound email and external messages in Vamsee Achanta's voice — a subtle offer to help, never bold or rash claims. Load before drafting ANY email, LinkedIn/Collide reply, proposal note, or outreach sent under his name.
Save/publish analysis or computation results from ANY ecosystem repo to Hugging Face as a queryable, viewer-renderable dataset. Use when the user wants to "save results to hugging face", "publish dataset to HF", "hugging face data saving", "save analysis results", "hf dataset", "make results queryable", or "render via datasets-server API". Reshapes nested results into flat parquet tables, writes a dataset card with a viewer `configs:` block and provenance, applies license/public-vs-private routing, enforces a domain data-quality gate (faithful-to-source != correct), publishes to `aceengineer/<repo>-<projection>`, and verifies via the datasets-server API.
Clone, create, fork, configure, and manage GitHub repositories. Manage remotes, secrets, releases, and workflows. Works with gh CLI or falls back to git + GitHub REST API via curl.
正在显示 SKILL.md
| name | pypdf-batch-pdf-processing-pipeline |
| description | Sub-skill of pypdf: Batch PDF Processing Pipeline. |
| version | 1.0.0 |
| category | data |
| type | reference |
| scripts_exempt | true |
"""
Batch process PDFs with configurable operations.
"""
from pypdf import PdfReader, PdfWriter, PdfMerger
from pathlib import Path
from typing import List, Dict, Any, Callable
from concurrent.futures import ThreadPoolExecutor, as_completed
import logging
logger = logging.getLogger(__name__)
class PDFProcessor:
"""Batch PDF processing with configurable operations."""
def __init__(self, output_dir: str):
self.output_dir = Path(output_dir)
self.output_dir.mkdir(parents=True, exist_ok=True)
def process_batch(
self,
pdf_files: List[str],
operations: List[Dict[str, Any]],
parallel: bool = False
) -> List[Dict]:
"""Process multiple PDFs with specified operations.
Args:
pdf_files: List of PDF file paths
operations: List of operation configs
parallel: Run in parallel if True
"""
results = []
if parallel:
with ThreadPoolExecutor(max_workers=4) as executor:
futures = {
executor.submit(self._process_single, f, operations): f
for f in pdf_files
}
for future in as_completed(futures):
results.append(future.result())
else:
for pdf_file in pdf_files:
results.append(self._process_single(pdf_file, operations))
return results
def _process_single(
self,
pdf_path: str,
operations: List[Dict[str, Any]]
) -> Dict:
"""Process single PDF with operations."""
result = {'file': pdf_path, 'success': True, 'operations': []}
try:
current_path = pdf_path
for op in operations:
op_name = op['name']
op_params = op.get('params', {})
output_path = str(
self.output_dir / f"{Path(current_path).stem}_{op_name}.pdf"
)
if op_name == 'rotate':
self._rotate(current_path, output_path, **op_params)
elif op_name == 'watermark':
self._watermark(current_path, output_path, **op_params)
elif op_name == 'extract_pages':
self._extract_pages(current_path, output_path, **op_params)
elif op_name == 'encrypt':
self._encrypt(current_path, output_path, **op_params)
result['operations'].append({
'name': op_name,
'output': output_path
})
current_path = output_path
result['final_output'] = current_path
except Exception as e:
result['success'] = False
result['error'] = str(e)
logger.exception(f"Failed to process {pdf_path}")
return result
def _rotate(self, input_path, output_path, rotation=90, pages=None):
reader = PdfReader(input_path)
writer = PdfWriter()
for i, page in enumerate(reader.pages):
if pages is None or i in pages:
page.rotate(rotation)
writer.add_page(page)
writer.write(output_path)
def _watermark(self, input_path, output_path, watermark_path):
reader = PdfReader(input_path)
watermark = PdfReader(watermark_path).pages[0]
writer = PdfWriter()
for page in reader.pages:
page.merge_page(watermark)
writer.add_page(page)
writer.write(output_path)
def _extract_pages(self, input_path, output_path, pages):
reader = PdfReader(input_path)
writer = PdfWriter()
for p in pages:
if 0 <= p < len(reader.pages):
writer.add_page(reader.pages[p])
writer.write(output_path)
def _encrypt(self, input_path, output_path, password):
reader = PdfReader(input_path)
writer = PdfWriter()
for page in reader.pages:
writer.add_page(page)
writer.encrypt(password)
writer.write(output_path)
# Example usage
# processor = PDFProcessor('processed_output/')
# results = processor.process_batch(
# ['doc1.pdf', 'doc2.pdf', 'doc3.pdf'],
# [
# {'name': 'rotate', 'params': {'rotation': 90}},
# {'name': 'watermark', 'params': {'watermark_path': 'watermark.pdf'}},
# {'name': 'encrypt', 'params': {'password': 'secure123'}}
# ],
# parallel=True
# )