用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/cxcscmu/SkillLearnBench --skill python-pypdf命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | python-pypdf |
| description | Guide on using the Python pypdf library to read, write, and fill PDF forms programmatically. |
The pypdf library allows you to manipulate PDF files in Python. This skill focuses on reading PDF form fields and filling them out programmatically.
pip install pypdf
You can read all form fields from a PDF to understand their names and types:
from pypdf import PdfReader
reader = PdfReader("form.pdf")
fields = reader.get_fields()
for field_name, field_data in fields.items():
print(f"Field: {field_name}, Type: {field_data.get('/FT')}, Value: {field_data.get('/V')}")
You can create a writer object, append the pages from the reader, and then use the update_page_form_field_values method to fill fields:
from pypdf import PdfReader, PdfWriter
reader = PdfReader("form.pdf")
writer = PdfWriter()
writer.append_pages_from_reader(reader)
# Define a dictionary mapping field names to values.
data = {
"FieldName1": "Value1",
"Checkbox1": "/Yes" # Checkboxes usually expect "/Yes" or "/Off"
}
writer.update_page_form_field_values(writer.pages[0], data)
with open("filled.pdf", "wb") as f:
writer.write(f)