[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BWMX0KKCPD7KKRB4QBGJ9R":3,"skill-same:01M7BWMX0KKCPD7KKRB4QBGJ9R":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7BWMX0KKCPD7KKRB4QBGJ9R","pdf-editing",null,"Complete guide for reading and editing PDF documents with PyMuPDF.","linyouxue\u002Fskill-repair-benchmark","linyouxue","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F216151464?v=4","01M7BJEVCXKD74KH6FG9CBVSQB","林宥学","01M7BJEVE02NP217V93BKZFC0J",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FOpus47-OriginalSkill-79Tasks-20260920\u002Fruns\u002Fopus47-original-skill\u002Fedit-pdf-opus47-original-skill-r001\u002Finputs\u002Fskills\u002Fpdf-editing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: pdf-editing\ndescription: \"Complete guide for reading and editing PDF documents with PyMuPDF.\"\n---\n\n# PDF Editing Skill\n\n## CRITICAL RULES - READ FIRST\n\n**NEVER DO THESE:**\n- NEVER use strikethrough lines to cross out text\n- NEVER rasterize or flatten the PDF to images\n- NEVER convert PDF pages to PNG\u002FJPG and draw on them\n- NEVER use pdf-to-image-to-pdf workflows\n- NEVER use add_redact_annot() with BLACK fill (use WHITE fill instead)\n- NEVER add text NEXT TO old values - REPLACE them at the SAME position\n\n**TWO APPROACHES - CHOOSE THE RIGHT ONE:**\n\n1. **For REPLACING text** (e.g., updating name, email, DOB):\n   - Use `draw_rect()` with white fill to cover old text\n   - Use `insert_text()` at the SAME position\n   - Text layer is preserved\n\n2. **For TRUE REDACTION of sensitive data** (e.g., student ID):\n   - Use `add_redact_annot(rect, fill=(1,1,1))` with WHITE fill\n   - Call `apply_redactions()` to REMOVE text from PDF structure\n   - Then `insert_text()` to add masked value (e.g., \"****5678\")\n   - Original text is completely removed, not just covered\n\n## Overview\n\n**USE PYTHON WITH PyMuPDF (fitz)** - it is pre-installed and produces the best results.\n\nPyMuPDF preserves the text layer properly, making text extractable after editing.\nJavaScript libraries like pdf-lib may create text that tools like pypdf cannot extract.\n\n```bash\n# PyMuPDF is already installed - just use it\npython3 -c \"import fitz; print('PyMuPDF ready')\"\n```\n\n## Reading PDF Content\n\n```python\nimport fitz\n\ndoc = fitz.open(\"input.pdf\")\npage = doc[0]\n\n# Extract all text to understand the document\ntext = page.get_text()\nprint(text)\n```\n\n## Finding Text Positions\n\n```python\n# search_for() returns list of rectangles where text is found\nrects = page.search_for(\"Label Text\")\nif rects:\n    rect = rects[0]\n    # rect.x0, rect.y0 = top-left corner\n    # rect.x1, rect.y1 = bottom-right corner\n    print(f\"Found at: ({rect.x0}, {rect.y0}) to ({rect.x1}, {rect.y1})\")\n```\n\n## Inserting Text\n\n```python\n# Insert text at a specific position\npage.insert_text(\n    (x_position, y_position),  # coordinates\n    \"text to insert\",\n    fontsize=11,\n    color=(0, 0, 0)  # black\n)\n\ndoc.save(\"output.pdf\")\n```\n\n## Common Pattern: Fill Empty Form Fields\n\nWhen a form field is empty (no existing value), insert text next to the label:\n\n```python\nimport fitz\n\ndoc = fitz.open(\"input.pdf\")\npage = doc[0]\n\n# Find label, insert value to the right of it\nlabel_rect = page.search_for(\"FIELD LABEL:\")[0]\npage.insert_text((label_rect.x1 + 5, label_rect.y1), \"value\", fontsize=11)\n\n# For today's date\nfrom datetime import datetime\ndate_rect = page.search_for(\"Date\")[0]\ntoday = datetime.now().strftime(\"%Y\u002F%m\u002F%d\")\npage.insert_text((date_rect.x1 + 5, date_rect.y1), today, fontsize=11)\n\n# For signatures - insert the person's name\nsig_rect = page.search_for(\"signature\")[0]\npage.insert_text((sig_rect.x1 + 5, sig_rect.y1), \"Full Name\", fontsize=12)\n\ndoc.save(\"output.pdf\")\n```\n\n## Replacing Existing Text (CRITICAL - MUST FOLLOW)\n\nWhen you need to replace text that's already in the PDF with new\u002Fcorrect values:\n\n1. First extract the PDF text to see what's currently there\n2. Compare with the correct values from your input source\n3. For any value that needs to change: **COVER with white rectangle, then insert new text AT THE SAME POSITION**\n\n### WRONG vs RIGHT approaches:\n\n**WRONG - DO NOT DO THIS:**\n```python\n# WRONG: Adding text next to old value\npage.insert_text((old_rect.x1 + 10, old_rect.y1), new_value)  # NO!\n\n# WRONG: Using strikethrough\npage.draw_line(start, end, color=(0,0,0))  # NO!\n\n# WRONG: Rasterizing to image\npix = page.get_pixmap()  # NO! Destroys text layer\n```\n\n**RIGHT - DO THIS:**\n```python\nimport fitz\n\ndoc = fitz.open(\"input.pdf\")\npage = doc[0]\n\n# First, extract text to see what's in the PDF\ncurrent_text = page.get_text()\nprint(current_text)  # Examine what values exist\n\n# To replace a value you found that needs changing:\nold_value = \"...\"  # The value you found in the PDF that's wrong\nnew_value = \"...\"  # The correct value from your input source\n\nrects = page.search_for(old_value)\nif rects:\n    rect = rects[0]\n\n    # STEP 1: Draw WHITE rectangle to COMPLETELY COVER old text\n    page.draw_rect(rect, color=(1, 1, 1), fill=(1, 1, 1), width=0)\n\n    # STEP 2: Insert new text at the SAME position (not offset!)\n    page.insert_text((rect.x0, rect.y1), new_value, fontsize=11, color=(0, 0, 0))\n\ndoc.save(\"output.pdf\")\n```\n\n**Key points:**\n- `draw_rect(rect, fill=(1,1,1), width=0)` draws a WHITE filled rectangle\n- `(1, 1, 1)` is white in RGB (0-1 scale)\n- Insert new text at `rect.x0` (same X position), NOT `rect.x1 + offset`\n- The old text becomes invisible under the white rectangle\n- The new text appears in the same location\n- Text layer is preserved (text remains extractable)\n\n## TRUE REDACTION for Sensitive Data (IMPORTANT!)\n\nFor sensitive data like student IDs, you must use TRUE REDACTION that removes the original text from the PDF structure. A white rectangle only VISUALLY covers text - tools like pypdf can still extract the hidden text!\n\n**CRITICAL DISTINCTION:**\n- `draw_rect()` = Visual cover only (text still extractable by machines)\n- `add_redact_annot()` + `apply_redactions()` = TRUE redaction (text removed from PDF)\n\n**Example:** \"A12345678\" should become \"****5678\" (show only last 4 digits)\n\n```python\nimport fitz\n\ndoc = fitz.open(\"input.pdf\")\npage = doc[0]\n\n# 1. First find what value is in the PDF by reading the text\npdf_text = page.get_text()\n# Find the ID in the text (e.g., \"A88888888\")\n\noriginal_in_pdf = \"A88888888\"  # Value you found in the PDF\n# Extract just the digits for masking\ndigits = ''.join(c for c in original_in_pdf if c.isdigit())\nmasked = \"****\" + digits[-4:]  # Result: \"****8888\"\n\nrects = page.search_for(original_in_pdf)\nif rects:\n    rect = rects[0]\n\n    # STEP 1: Create TIGHT bounding box to avoid covering nearby labels\n    tight_rect = fitz.Rect(rect.x0, rect.y0 + 8, rect.x1, rect.y1 - 2)\n\n    # STEP 2: Add redaction annotation with WHITE fill (not black!)\n    page.add_redact_annot(tight_rect, fill=(1, 1, 1))  # WHITE fill\n\n    # STEP 2: Apply redactions - this REMOVES the text from PDF structure\n    page.apply_redactions()\n\n    # STEP 3: Insert masked value at the same position\n    page.insert_text((rect.x0, rect.y1), masked, fontsize=11, color=(0, 0, 0))\n\ndoc.save(\"output.pdf\")\n```\n\n**Why this works:**\n- `add_redact_annot(rect, fill=(1, 1, 1))` - marks area with WHITE rectangle\n- `apply_redactions()` - REMOVES the underlying text from PDF structure\n- `insert_text()` - adds the masked value\n\n**WRONG approaches:**\n```python\n# WRONG: Black box redaction (ugly and suspicious)\npage.add_redact_annot(rect, fill=(0, 0, 0))  # NO! Use white fill\n\n# WRONG: Only using draw_rect (text still extractable!)\npage.draw_rect(rect, fill=(1, 1, 1))  # NO! This only covers visually\npage.insert_text(...)  # Original text is still in PDF structure!\n\n# WRONG: Adding masked value NEXT TO original\npage.insert_text((rect.x1 + 10, rect.y1), masked)  # NO!\n```\n\n\n\n## Workflow: Compare and Update\n\n```python\nimport fitz\n\ndoc = fitz.open(\"input.pdf\")\npage = doc[0]\n\n# Step 1: Read PDF to see current content\npdf_text = page.get_text()\nprint(pdf_text)\n\n# Step 2: Read your input source to get correct values\n# (parse input file, extract the values you need)\n\n# Step 3: For each value that differs, replace it\n# Build a dict of {old_value_in_pdf: correct_value}\nreplacements = {}  # Populate by comparing PDF content with correct values\n\nfor old_val, new_val in replacements.items():\n    if old_val == new_val:\n        continue  # Skip if already correct\n    rects = page.search_for(old_val)\n    if rects:\n        rect = rects[0]\n        # Cover old text with white rectangle\n        page.draw_rect(rect, color=(1, 1, 1), fill=(1, 1, 1), width=0)\n        # Insert new text\n        page.insert_text((rect.x0, rect.y1), new_val, fontsize=11, color=(0, 0, 0))\n\ndoc.save(\"output.pdf\")\n```\n\n## Important Guidelines\n\n1. **COVER then REPLACE** - Use white rectangle to cover old text, insert new text at SAME position\n2. **Never use strikethrough** - No lines through text, no crossing out\n3. **Never rasterize** - No converting PDF to images, no get_pixmap() workflows\n4. **Never add text NEXT TO old values** - Replace AT the same position\n5. **Never use add_redact_annot() with black** - It creates black boxes\n6. **Preserve all labels** - Form labels should remain visible\n7. **Preserve text layer** - Text must remain extractable after editing\n8. **Match font size** - Typically 10-12pt for forms\n\n## Alternative: JavaScript with pdf-lib (NOT RECOMMENDED)\n\n**WARNING:** pdf-lib may create text that cannot be extracted by pypdf.\nUse Python with PyMuPDF instead whenever possible.\n\nIf you must use Node.js\u002FJavaScript, use pdf-lib with the same approach:\n\n```javascript\nconst { PDFDocument, rgb } = require('pdf-lib');\nconst fs = require('fs');\n\nasync function editPdf() {\n  const pdfBytes = fs.readFileSync('input.pdf');\n  const pdfDoc = await PDFDocument.load(pdfBytes);\n  const page = pdfDoc.getPages()[0];\n  const { height } = page.getSize();\n\n  \u002F\u002F To replace text at known coordinates:\n  \u002F\u002F STEP 1: Draw WHITE rectangle to cover old text\n  page.drawRectangle({\n    x: oldTextX,\n    y: oldTextY,\n    width: oldTextWidth,\n    height: oldTextHeight,\n    color: rgb(1, 1, 1),  \u002F\u002F WHITE\n  });\n\n  \u002F\u002F STEP 2: Draw new text at the SAME position\n  page.drawText('New Value', {\n    x: oldTextX,  \u002F\u002F SAME X position, not offset!\n    y: oldTextY,\n    size: 11,\n    color: rgb(0, 0, 0),\n  });\n\n  fs.writeFileSync('output.pdf', await pdfDoc.save());\n}\n```\n\n**WRONG with pdf-lib:**\n```javascript\n\u002F\u002F WRONG: Adding text to the right of old value\npage.drawText('New Value', {\n  x: oldTextX + oldTextWidth + 10,  \u002F\u002F NO! Don't offset\n  ...\n});\n\n\u002F\u002F WRONG: Drawing strikethrough line\npage.drawLine({\n  start: { x: x1, y: y },\n  end: { x: x2, y: y },\n  color: rgb(0, 0, 0),  \u002F\u002F NO strikethrough!\n});\n```\n\n","# PDF Editing Skill\n\n## CRITICAL RULES - READ FIRST\n\n**NEVER DO THESE:**\n- NEVER use strikethrough lines to cross out text\n- NEVER rasterize or flatten the PDF to images\n- NEVER convert PDF pages to PNG\u002FJPG and draw on them\n- NEVER use pdf-to-image-to-pdf workflows\n- NEVER use add_redact_annot() with BLACK fill (use WHITE fill instead)\n- NEVER add text NEXT TO old values - REPLACE them at the SAME position\n\n**TWO APPROACHES - CHOOSE THE RIGHT ONE:**\n\n1. **For REPLACING text** (e.g., updating name, email, DOB):\n   - Use `draw_rect()` with white fill to cover old text\n   - Use `insert_text()` at the SAME position\n   - Text layer is preserved\n\n2. **For TRUE REDACTION of sensitive data** (e.g., student ID):\n   - Use `add_redact_annot(rect, fill=(1,1,1))` with WHITE fill\n   - Call `apply_redactions()` to REMOVE text from PDF structure\n   - Then `insert_text()` to add masked value (e.g., \"****5678\")\n   - Original text is completely removed, not just covered\n\n## Overview\n\n**USE PYTHON WITH PyMuPDF (fitz)** - it is pre-installed and produces the best results.\n\nPyMuPDF preserves the text layer properly, making text extractable after editing.\nJavaScript libraries like pdf-lib may create text that tools like pypdf cannot extract.\n\n```bash\n# PyMuPDF is already installed - just use it\npython3 -c \"import fitz; print('PyMuPDF ready')\"\n```\n\n## Reading PDF Content\n\n```python\nimport fitz\n\ndoc = fitz.open(\"input.pdf\")\npage = doc[0]\n\n# Extract all text to understand the document\ntext = page.get_text()\nprint(text)\n```\n\n## Finding Text Positions\n\n```python\n# search_for() returns list of rectangles where text is found\nrects = page.search_for(\"Label Text\")\nif rects:\n    rect = rects[0]\n    # rect.x0, rect.y0 = top-left corner\n    # rect.x1, rect.y1 = bottom-right corner\n    print(f\"Found at: ({rect.x0}, {rect.y0}) to ({rect.x1}, {rect.y1})\")\n```\n\n## Inserting Text\n\n```python\n# Insert text at a specific position\npage.insert_text(\n    (x_position, y_position),  # coordinates\n    \"text to insert\",\n    fontsize=11,\n    color=(0, 0, 0)  # black\n)\n\ndoc.save(\"output.pdf\")\n```\n\n## Common Pattern: Fill Empty Form Fields\n\nWhen a form field is empty (no existing value), insert text next to the label:\n\n```python\nimport fitz\n\ndoc = fitz.open(\"input.pdf\")\npage = doc[0]\n\n# Find label, insert value to the right of it\nlabel_rect = page.search_for(\"FIELD LABEL:\")[0]\npage.insert_text((label_rect.x1 + 5, label_rect.y1), \"value\", fontsize=11)\n\n# For today's date\nfrom datetime import datetime\ndate_rect = page.search_for(\"Date\")[0]\ntoday = datetime.now().strftime(\"%Y\u002F%m\u002F%d\")\npage.insert_text((date_rect.x1 + 5, date_rect.y1), today, fontsize=11)\n\n# For signatures - insert the person's name\nsig_rect = page.search_for(\"signature\")[0]\npage.insert_text((sig_rect.x1 + 5, sig_rect.y1), \"Full Name\", fontsize=12)\n\ndoc.save(\"output.pdf\")\n```\n\n## Replacing Existing Text (CRITICAL - MUST FOLLOW)\n\nWhen you need to replace text that's already in the PDF with new\u002Fcorrect values:\n\n1. First extract the PDF text to see what's currently there\n2. Compare with the correct values from your input source\n3. For any value that needs to change: **COVER with white rectangle, then insert new text AT THE SAME POSITION**\n\n### WRONG vs RIGHT approaches:\n\n**WRONG - DO NOT DO THIS:**\n```python\n# WRONG: Adding text next to old value\npage.insert_text((old_rect.x1 + 10, old_rect.y1), new_value)  # NO!\n\n# WRONG: Using strikethrough\npage.draw_line(start, end, color=(0,0,0))  # NO!\n\n# WRONG: Rasterizing to image\npix = page.get_pixmap()  # NO! Destroys text layer\n```\n\n**RIGHT - DO THIS:**\n```python\nimport fitz\n\ndoc = fitz.open(\"input.pdf\")\npage = doc[0]\n\n# First, extract text to see what's in the PDF\ncurrent_text = page.get_text()\nprint(current_text)  # Examine what values exist\n\n# To replace a value you found that needs changing:\nold_value = \"...\"  # The value you found in the PDF that's wrong\nnew_value = \"...\"  # The correct value from your input source\n\nrects = page.search_for(old_value)\nif rects:\n    rect = rects[0]\n\n    # STEP 1: Draw WHITE rectangle to COMPLETELY COVER old text\n    page.draw_rect(rect, color=(1, 1, 1), fill=(1, 1, 1), width=0)\n\n    # STEP 2: Insert new text at the SAME position (not offset!)\n    page.insert_text((rect.x0, rect.y1), new_value, fontsize=11, color=(0, 0, 0))\n\ndoc.save(\"output.pdf\")\n```\n\n**Key points:**\n- `draw_rect(rect, fill=(1,1,1), width=0)` draws a WHITE filled rectangle\n- `(1, 1, 1)` is white in RGB (0-1 scale)\n- Insert new text at `rect.x0` (same X position), NOT `rect.x1 + offset`\n- The old text becomes invisible under the white rectangle\n- The new text appears in the same location\n- Text layer is preserved (text remains extractable)\n\n## TRUE REDACTION for Sensitive Data (IMPORTANT!)\n\nFor sensitive data like student IDs, you must use TRUE REDACTION that removes the original text from the PDF structure. A white rectangle only VISUALLY covers text - tools like pypdf can still extract the hidden text!\n\n**CRITICAL DISTINCTION:**\n- `draw_rect()` = Visual cover only (text still extractable by machines)\n- `add_redact_annot()` + `apply_redactions()` = TRUE redaction (text removed from PDF)\n\n**Example:** \"A12345678\" should become \"****5678\" (show only last 4 digits)\n\n```python\nimport fitz\n\ndoc = fitz.open(\"input.pdf\")\npage = doc[0]\n\n# 1. First find what value is in the PDF by reading the text\npdf_text = page.get_text()\n# Find the ID in the text (e.g., \"A88888888\")\n\noriginal_in_pdf = \"A88888888\"  # Value you found in the PDF\n# Extract just the digits for masking\ndigits = ''.join(c for c in original_in_pdf if c.isdigit())\nmasked = \"****\" + digits[-4:]  # Result: \"****8888\"\n\nrects = page.search_for(original_in_pdf)\nif rects:\n    rect = rects[0]\n\n    # STEP 1: Create TIGHT bounding box to avoid covering nearby labels\n    tight_rect = fitz.Rect(rect.x0, rect.y0 + 8, rect.x1, rect.y1 - 2)\n\n    # STEP 2: Add redaction annotation with WHITE fill (not black!)\n    page.add_redact_annot(tight_rect, fill=(1, 1, 1))  # WHITE fill\n\n    # STEP 2: Apply redactions - this REMOVES the text from PDF structure\n    page.apply_redactions()\n\n    # STEP 3: Insert masked value at the same position\n    page.insert_text((rect.x0, rect.y1), masked, fontsize=11, color=(0, 0, 0))\n\ndoc.save(\"output.pdf\")\n```\n\n**Why this works:**\n- `add_redact_annot(rect, fill=(1, 1, 1))` - marks area with WHITE rectangle\n- `apply_redactions()` - REMOVES the underlying text from PDF structure\n- `insert_text()` - adds the masked value\n\n**WRONG approaches:**\n```python\n# WRONG: Black box redaction (ugly and suspicious)\npage.add_redact_annot(rect, fill=(0, 0, 0))  # NO! Use white fill\n\n# WRONG: Only using draw_rect (text still extractable!)\npage.draw_rect(rect, fill=(1, 1, 1))  # NO! This only covers visually\npage.insert_text(...)  # Original text is still in PDF structure!\n\n# WRONG: Adding masked value NEXT TO original\npage.insert_text((rect.x1 + 10, rect.y1), masked)  # NO!\n```\n\n\n\n## Workflow: Compare and Update\n\n```python\nimport fitz\n\ndoc = fitz.open(\"input.pdf\")\npage = doc[0]\n\n# Step 1: Read PDF to see current content\npdf_text = page.get_text()\nprint(pdf_text)\n\n# Step 2: Read your input source to get correct values\n# (parse input file, extract the values you need)\n\n# Step 3: For each value that differs, replace it\n# Build a dict of {old_value_in_pdf: correct_value}\nreplacements = {}  # Populate by comparing PDF content with correct values\n\nfor old_val, new_val in replacements.items():\n    if old_val == new_val:\n        continue  # Skip if already correct\n    rects = page.search_for(old_val)\n    if rects:\n        rect = rects[0]\n        # Cover old text with white rectangle\n        page.draw_rect(rect, color=(1, 1, 1), fill=(1, 1, 1), width=0)\n        # Insert new text\n        page.insert_text((rect.x0, rect.y1), new_val, fontsize=11, color=(0, 0, 0))\n\ndoc.save(\"output.pdf\")\n```\n\n## Important Guidelines\n\n1. **COVER then REPLACE** - Use white rectangle to cover old text, insert new text at SAME position\n2. **Never use strikethrough** - No lines through text, no crossing out\n3. **Never rasterize** - No converting PDF to images, no get_pixmap() workflows\n4. **Never add text NEXT TO old values** - Replace AT the same position\n5. **Never use add_redact_annot() with black** - It creates black boxes\n6. **Preserve all labels** - Form labels should remain visible\n7. **Preserve text layer** - Text must remain extractable after editing\n8. **Match font size** - Typically 10-12pt for forms\n\n## Alternative: JavaScript with pdf-lib (NOT RECOMMENDED)\n\n**WARNING:** pdf-lib may create text that cannot be extracted by pypdf.\nUse Python with PyMuPDF instead whenever possible.\n\nIf you must use Node.js\u002FJavaScript, use pdf-lib with the same approach:\n\n```javascript\nconst { PDFDocument, rgb } = require('pdf-lib');\nconst fs = require('fs');\n\nasync function editPdf() {\n  const pdfBytes = fs.readFileSync('input.pdf');\n  const pdfDoc = await PDFDocument.load(pdfBytes);\n  const page = pdfDoc.getPages()[0];\n  const { height } = page.getSize();\n\n  \u002F\u002F To replace text at known coordinates:\n  \u002F\u002F STEP 1: Draw WHITE rectangle to cover old text\n  page.drawRectangle({\n    x: oldTextX,\n    y: oldTextY,\n    width: oldTextWidth,\n    height: oldTextHeight,\n    color: rgb(1, 1, 1),  \u002F\u002F WHITE\n  });\n\n  \u002F\u002F STEP 2: Draw new text at the SAME position\n  page.drawText('New Value', {\n    x: oldTextX,  \u002F\u002F SAME X position, not offset!\n    y: oldTextY,\n    size: 11,\n    color: rgb(0, 0, 0),\n  });\n\n  fs.writeFileSync('output.pdf', await pdfDoc.save());\n}\n```\n\n**WRONG with pdf-lib:**\n```javascript\n\u002F\u002F WRONG: Adding text to the right of old value\npage.drawText('New Value', {\n  x: oldTextX + oldTextWidth + 10,  \u002F\u002F NO! Don't offset\n  ...\n});\n\n\u002F\u002F WRONG: Drawing strikethrough line\npage.drawLine({\n  start: { x: x1, y: y },\n  end: { x: x2, y: y },\n  color: rgb(0, 0, 0),  \u002F\u002F NO strikethrough!\n});\n```\n\n",{"name":5,"description":7},"main","cdcb6d230f3b15c3c33f8a2bdd16439f43602cbe","evaluation\u002Fresults\u002FOpus47-OriginalSkill-79Tasks-20260920\u002Fruns\u002Fopus47-original-skill\u002Fedit-pdf-opus47-original-skill-r001\u002Finputs\u002Fskills\u002Fpdf-editing",1,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark","https:\u002F\u002Fgithub.com\u002Flinyouxue","2026-11-14 20:28:35",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add linyouxue\u002Fskill-repair-benchmark --skill pdf-editing",{"tool":37,"command":38},"bunx","bunx skills add linyouxue\u002Fskill-repair-benchmark --skill pdf-editing",{"tool":40,"command":41},"pnpm","pnpm dlx skills add linyouxue\u002Fskill-repair-benchmark --skill pdf-editing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FOpus47-OriginalSkill-79Tasks-20260920\u002Fruns\u002Fopus47-original-skill\u002Fedit-pdf-opus47-original-skill-r001\u002Finputs\u002Fskills\u002Fpdf-editing\u002FSKILL.md",true,[],[46,53,60,67,72,77],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M7E1HGVRY73NBJ022CJG13X6","video-frame-extraction","Extract frames from video files and save them as images using OpenCV","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7E1HAG5R7CJ9C8NYJS771MB","openai-vision","Analyze images and multi-frame sequences using OpenAI GPT vision models","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7E1H7DADKB6QBWKC2KQ63SZ","image-ocr","Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[],{"skillNo":68,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7E1H0WBNT43TENGQY7AVZHD","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":73,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7E1GTC7D4N4Q2EF03875J9E","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":78,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7E1GQ92CWFMGH53KSSE4WER","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[]]