[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KH0YBHTN9XMEX8VB1GS1QJ":3,"skill-same:01M6KH0YBHTN9XMEX8VB1GS1QJ":60},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":33,"linkOnly":34,"markdownContent":35,"markdownBody":36,"frontMatter":37,"refName":38,"commitSha":39,"skillDirectory":40,"forksCount":41,"repositoryHtmlUrl":42,"repositoryHomepageUrl":43,"ownerHtmlUrl":44,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":45,"install":46,"resources":59},"01M6KH0YBHTN9XMEX8VB1GS1QJ","python-pdf-form-filling",null,"Use this skill when you need to programmatically fill PDF form fields using Python. Covers inspecting field names and writing values to fillable PDFs.","cxcscmu\u002FSkillLearnBench","cxcscmu","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142838272?v=4","01M6KCQDFQWPDSN0MKZY96MSQP","01M6KCQDM7G70TKJ28NTSQC0RZ",92,"MIT","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fb3-teacher-feedback-claude-opus-4-6\u002Fcourt-form-filling\u002Frun1_python-pdf-form-filling\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32],"PDF","python","form","pdf form filling","python pdf form filling","writing","use","you","values","fill","2026-11-10 10:12:30",false,"---\nname: python-pdf-form-filling\ndescription: Use this skill when you need to programmatically fill PDF form fields using Python. Covers inspecting field names and writing values to fillable PDFs.\n---\n\n# Filling PDF Forms with Python\n\n## Recommended Libraries\n\n### Option 1: PyPDF2 \u002F PyPDF (pypdf)\n```python\nfrom pypdf import PdfReader, PdfWriter\n\nreader = PdfReader(\"input.pdf\")\nwriter = PdfWriter()\n\n# Clone the original\nwriter.append(reader)\n\n# Inspect field names\nfields = reader.get_fields()\nfor field_name, field_obj in fields.items():\n    print(f\"Field: {field_name}, Type: {field_obj.get('\u002FFT')}, Value: {field_obj.get('\u002FV')}\")\n```\n\nFilling fields:\n```python\nfrom pypdf import PdfReader, PdfWriter\n\nreader = PdfReader(\"sc100-blank.pdf\")\nwriter = PdfWriter()\nwriter.append(reader)\n\n# Fill fields by name\nfill_data = {\n    \"FieldName1\": \"Value1\",\n    \"FieldName2\": \"Value2\",\n}\n\nwriter.update_page_form_field_values(writer.pages[0], fill_data)\n# For multi-page forms, repeat for each page index\n\nwith open(\"sc100-filled.pdf\", \"wb\") as f:\n    writer.write(f)\n```\n\n### Option 2: pdfrw\n```python\nimport pdfrw\n\ntemplate = pdfrw.PdfReader(\"sc100-blank.pdf\")\n\n# Iterate annotations to find fields\nfor page in template.pages:\n    annotations = page.get('\u002FAnnots')\n    if annotations:\n        for annot in annotations:\n            field_name = annot.get('\u002FT')\n            field_type = annot.get('\u002FFT')\n            print(f\"Field: {field_name}, Type: {field_type}\")\n```\n\nFilling with pdfrw:\n```python\nimport pdfrw\n\nANNOT_KEY = '\u002FAnnots'\nANNOT_FIELD_KEY = '\u002FT'\nANNOT_VAL_KEY = '\u002FV'\nANNOT_RECT_KEY = '\u002FRect'\nSUBTYPE_KEY = '\u002FSubtype'\nWIDGET_SUBTYPE_KEY = '\u002FWidget'\n\ntemplate = pdfrw.PdfReader(\"sc100-blank.pdf\")\n\ndata = {\n    \"(FieldName1)\": \"Value1\",\n    \"(FieldName2)\": \"Value2\",\n}\n\nfor page in template.pages:\n    annotations = page.get(ANNOT_KEY)\n    if annotations:\n        for annot in annotations:\n            field_name = annot.get(ANNOT_FIELD_KEY)\n            if field_name in data:\n                annot.update(pdfrw.PdfDict(V=data[field_name]))\n                # For text fields, also set appearance if needed\n                annot.update(pdfrw.PdfDict(AP=''))  # Reset appearance\n\npdfrw.PdfWriter().write(\"sc100-filled.pdf\", template)\n```\n\n### Option 3: fillpdf \u002F pdftk wrapper\n```python\nfrom fillpdf import fillpdfs\n\n# Get field names\nfields = fillpdfs.get_form_fields(\"sc100-blank.pdf\")\nprint(fields)\n\n# Fill the form\ndata_dict = {\n    \"FieldName1\": \"Value1\",\n    \"FieldName2\": \"Value2\",\n}\nfillpdfs.write_fillable_pdf(\"sc100-blank.pdf\", \"sc100-filled.pdf\", data_dict)\n```\n\n### Option 4: pikepdf\n```python\nimport pikepdf\n\npdf = pikepdf.open(\"sc100-blank.pdf\")\n\n# Access AcroForm\nif '\u002FAcroForm' in pdf.Root:\n    fields = pdf.Root.AcroForm.get('\u002FFields', [])\n    for field_ref in fields:\n        field = field_ref\n        name = str(field.get('\u002FT', ''))\n        print(f\"Field: {name}, Type: {field.get('\u002FFT')}\")\n```\n\n## Handling Checkboxes\n\nCheckboxes have specific \"on\" values. To find the valid value:\n```python\n# With pypdf\nfields = reader.get_fields()\nfor name, field in fields.items():\n    if field.get('\u002FFT') == '\u002FBtn':\n        # Check the appearance dictionary for valid states\n        print(f\"Checkbox: {name}\")\n        # The widget annotation's \u002FAP\u002FN dictionary keys show valid states\n```\n\nCommon checkbox patterns:\n- Set to `\u002FYes` or the export value found in `\u002FAP\u002FN` keys\n- Uncheck by setting to `\u002FOff`\n\nFor pypdf:\n```python\n# To check a checkbox, you often need:\nwriter.update_page_form_field_values(\n    writer.pages[0],\n    {\"CheckboxFieldName\": \"\u002FYes\"},  # or \"Yes\" or True depending on form\n    auto_regenerate=False\n)\n```\n\n## Key Tips\n1. **Always inspect field names first** — PDF field names are not standardized.\n2. **Flatten vs non-flatten**: Some approaches flatten the form (making fields non-editable). Use `flatten=False` if you want to keep fields editable.\n3. **Multi-page forms**: Ensure you fill fields on the correct page.\n4. **Field hierarchy**: Some PDFs use hierarchical field names like `parent.child`. The full qualified name matters.\n5. **Encoding**: Use `pdfrw.PdfString.encode()` for pdfrw string values if needed.","# Filling PDF Forms with Python\n\n## Recommended Libraries\n\n### Option 1: PyPDF2 \u002F PyPDF (pypdf)\n```python\nfrom pypdf import PdfReader, PdfWriter\n\nreader = PdfReader(\"input.pdf\")\nwriter = PdfWriter()\n\n# Clone the original\nwriter.append(reader)\n\n# Inspect field names\nfields = reader.get_fields()\nfor field_name, field_obj in fields.items():\n    print(f\"Field: {field_name}, Type: {field_obj.get('\u002FFT')}, Value: {field_obj.get('\u002FV')}\")\n```\n\nFilling fields:\n```python\nfrom pypdf import PdfReader, PdfWriter\n\nreader = PdfReader(\"sc100-blank.pdf\")\nwriter = PdfWriter()\nwriter.append(reader)\n\n# Fill fields by name\nfill_data = {\n    \"FieldName1\": \"Value1\",\n    \"FieldName2\": \"Value2\",\n}\n\nwriter.update_page_form_field_values(writer.pages[0], fill_data)\n# For multi-page forms, repeat for each page index\n\nwith open(\"sc100-filled.pdf\", \"wb\") as f:\n    writer.write(f)\n```\n\n### Option 2: pdfrw\n```python\nimport pdfrw\n\ntemplate = pdfrw.PdfReader(\"sc100-blank.pdf\")\n\n# Iterate annotations to find fields\nfor page in template.pages:\n    annotations = page.get('\u002FAnnots')\n    if annotations:\n        for annot in annotations:\n            field_name = annot.get('\u002FT')\n            field_type = annot.get('\u002FFT')\n            print(f\"Field: {field_name}, Type: {field_type}\")\n```\n\nFilling with pdfrw:\n```python\nimport pdfrw\n\nANNOT_KEY = '\u002FAnnots'\nANNOT_FIELD_KEY = '\u002FT'\nANNOT_VAL_KEY = '\u002FV'\nANNOT_RECT_KEY = '\u002FRect'\nSUBTYPE_KEY = '\u002FSubtype'\nWIDGET_SUBTYPE_KEY = '\u002FWidget'\n\ntemplate = pdfrw.PdfReader(\"sc100-blank.pdf\")\n\ndata = {\n    \"(FieldName1)\": \"Value1\",\n    \"(FieldName2)\": \"Value2\",\n}\n\nfor page in template.pages:\n    annotations = page.get(ANNOT_KEY)\n    if annotations:\n        for annot in annotations:\n            field_name = annot.get(ANNOT_FIELD_KEY)\n            if field_name in data:\n                annot.update(pdfrw.PdfDict(V=data[field_name]))\n                # For text fields, also set appearance if needed\n                annot.update(pdfrw.PdfDict(AP=''))  # Reset appearance\n\npdfrw.PdfWriter().write(\"sc100-filled.pdf\", template)\n```\n\n### Option 3: fillpdf \u002F pdftk wrapper\n```python\nfrom fillpdf import fillpdfs\n\n# Get field names\nfields = fillpdfs.get_form_fields(\"sc100-blank.pdf\")\nprint(fields)\n\n# Fill the form\ndata_dict = {\n    \"FieldName1\": \"Value1\",\n    \"FieldName2\": \"Value2\",\n}\nfillpdfs.write_fillable_pdf(\"sc100-blank.pdf\", \"sc100-filled.pdf\", data_dict)\n```\n\n### Option 4: pikepdf\n```python\nimport pikepdf\n\npdf = pikepdf.open(\"sc100-blank.pdf\")\n\n# Access AcroForm\nif '\u002FAcroForm' in pdf.Root:\n    fields = pdf.Root.AcroForm.get('\u002FFields', [])\n    for field_ref in fields:\n        field = field_ref\n        name = str(field.get('\u002FT', ''))\n        print(f\"Field: {name}, Type: {field.get('\u002FFT')}\")\n```\n\n## Handling Checkboxes\n\nCheckboxes have specific \"on\" values. To find the valid value:\n```python\n# With pypdf\nfields = reader.get_fields()\nfor name, field in fields.items():\n    if field.get('\u002FFT') == '\u002FBtn':\n        # Check the appearance dictionary for valid states\n        print(f\"Checkbox: {name}\")\n        # The widget annotation's \u002FAP\u002FN dictionary keys show valid states\n```\n\nCommon checkbox patterns:\n- Set to `\u002FYes` or the export value found in `\u002FAP\u002FN` keys\n- Uncheck by setting to `\u002FOff`\n\nFor pypdf:\n```python\n# To check a checkbox, you often need:\nwriter.update_page_form_field_values(\n    writer.pages[0],\n    {\"CheckboxFieldName\": \"\u002FYes\"},  # or \"Yes\" or True depending on form\n    auto_regenerate=False\n)\n```\n\n## Key Tips\n1. **Always inspect field names first** — PDF field names are not standardized.\n2. **Flatten vs non-flatten**: Some approaches flatten the form (making fields non-editable). Use `flatten=False` if you want to keep fields editable.\n3. **Multi-page forms**: Ensure you fill fields on the correct page.\n4. **Field hierarchy**: Some PDFs use hierarchical field names like `parent.child`. The full qualified name matters.\n5. **Encoding**: Use `pdfrw.PdfString.encode()` for pdfrw string values if needed.",{"name":5,"description":7},"main","726e1f79b96b0cb3d729d0e55a1c847e0b5353ae","skills\u002Fb3-teacher-feedback-claude-opus-4-6\u002Fcourt-form-filling\u002Frun1_python-pdf-form-filling",7,"https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench","https:\u002F\u002Fcxcscmu.github.io\u002FSkillLearnBench","https:\u002F\u002Fgithub.com\u002Fcxcscmu","2026-10-02 22:55:36",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add cxcscmu\u002FSkillLearnBench --skill python-pdf-form-filling",{"tool":52,"command":53},"bunx","bunx skills add cxcscmu\u002FSkillLearnBench --skill python-pdf-form-filling",{"tool":55,"command":56},"pnpm","pnpm dlx skills add cxcscmu\u002FSkillLearnBench --skill python-pdf-form-filling","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fb3-teacher-feedback-claude-opus-4-6\u002Fcourt-form-filling\u002Frun1_python-pdf-form-filling\u002FSKILL.md",true,[],[61,77,102,119,139,151],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":70,"publishedAt":33},"01M6KM5KH175P5ABP5JMX2SBDQ","object_counter","Count occurrences of an object in the image using computer vision algorithm.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Fvideo-object-counting\u002Fobject_counter\u002FSKILL.md",[67],{"categoryNo":68,"categoryName":69,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000016","图像与多媒体",[71,72,73,74,75,76],"object counter","object","vision","computer","Computer Vision","image",{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":86,"publishedAt":33},"01M6KM51TMVXG79MMPCS6Y8G86","travel-planning-workflow","Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftravel-planning\u002Ftravel-planning-workflow\u002FSKILL.md",[83],{"categoryNo":84,"categoryName":85,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",[87,88,89,90,91,92,93,94,95,96,97,98,99,100,101],"workflow","planning","planning workflow","travel","travel planning","travel planning workflow","structured","performing","plan","for","user","it","requirements","essential","itineraries",{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":33},"01M6KM4DY820XHS9YTSK5QP5HD","bundled-dataset-search-tool","invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftravel-planning\u002Fbundled-dataset-search-tool\u002FSKILL.md",[],[109,110,111,112,113,114,115,90,116,117,91,30,96,118,88],"search","tool","dataset","bundled dataset search tool","restaurants","Tools","up","look","flights","database",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":33},"01M6KM465BB9PQ0B548HQSVAWZ","glm-output","Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final \u002Froot\u002Fmetrics.json.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftemperature-simulation\u002Fglm-output\u002FSKILL.md",[],[126,127,128,96,129,130,131,132,133,134,135,136,30,137,138],"glm output","output","glm","tasks","metrics","json","basics","guidance","matching","verifier","processing","root","calibration",{"skillNo":140,"name":141,"nameZh":6,"description":142,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":143,"categories":144,"keywords":146,"publishedAt":33},"01M6KM40KY3QWDW5W97S39R2BC","glm-calibration","Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftemperature-simulation\u002Fglm-calibration\u002FSKILL.md",[145],{"categoryNo":84,"categoryName":85,"taxonomyType":20,"taxonomyTypeDesc":21},[147,138,128,127,133,132,129,148,149,96,150],"glm calibration","setup","companion","metric",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":33},"01M6KM3VHHVSGMGHJQB3PPT6YG","glm-basics","A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftemperature-simulation\u002Fglm-basics\u002FSKILL.md",[],[158,128,132,159,147,138,96,127,160,161,162,29,163,164,129],"glm basics","inspect","relevant","files","good","how","Evaluation"]