[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XBSK9S9Y18Y7E6YCASTCRC":3,"skill-same:01M6XBSK9S9Y18Y7E6YCASTCRC":68},{"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":37,"linkOnly":38,"markdownContent":39,"markdownBody":40,"frontMatter":41,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":13,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":47,"install":48,"resources":61},"01M6XBSK9S9Y18Y7E6YCASTCRC","pdf-text-extraction-9424c5",null,"Extract text from PDF files using pdftotext when read_file returns binary data","UF-gzj\u002Fopenspace-claude-evolution","UF-gzj","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F272393507?v=4","01M6XBCZB755P01VVYGQWPYZY3","01M6XBCZFJA5AREA17WGETA3FW",0,"MIT","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-text-extraction-9424c5\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32,33,34,35,36],"PDF","extraction","text","pdf text extraction 9424c5","pdf text extraction","file","data","returns","read","extract","files","binary","pdftotext","when","2026-11-10 10:12:30",false,"---\nname: pdf-text-extraction-9424c5\ndescription: Extract text from PDF files using pdftotext when read_file returns binary data\n---\n\n# PDF Text Extraction via pdftotext\n\n## Problem\n\nWhen using `read_file` on PDF documents, the function may return binary image data or garbled content instead of readable text. This occurs because PDFs can contain scanned images or complex binary structures that `read_file` cannot properly parse as text.\n\n## Solution\n\nUse the `pdftotext` command-line utility via `run_shell` to extract clean text content from PDF files.\n\n## Steps\n\n### 1. Verify PDF file exists\n\n```python\nimport os\n\npdf_path = \"path\u002Fto\u002Fdocument.pdf\"\nif not os.path.exists(pdf_path):\n    raise FileNotFoundError(f\"PDF not found: {pdf_path}\")\n```\n\n### 2. Extract text using pdftotext\n\n```python\nfrom tools import run_shell\n\n# Extract text to stdout\nresult = run_shell(command=f\"pdftotext '{pdf_path}' -\", timeout=60)\npdf_text = result.stdout\n\n# Alternative: extract to a temporary file\ntemp_txt = \"\u002Ftmp\u002Fextracted.txt\"\nrun_shell(command=f\"pdftotext '{pdf_path}' '{temp_txt}'\", timeout=60)\nwith open(temp_txt, 'r') as f:\n    pdf_text = f.read()\n```\n\n### 3. Handle parameter naming carefully\n\nWhen calling `read_file`, be aware of the parameter name:\n- Use `filetype=\"pdf\"` (not `file_type`)\n- Some tool implementations may use different parameter names\n\n```python\n# Correct parameter usage\ncontent = read_file(file_path=\"doc.pdf\", filetype=\"pdf\")\n\n# If this returns binary\u002Fgarbled data, fall back to pdftotext\n```\n\n## Common pdftotext Options\n\n| Option | Description |\n|--------|-------------|\n| `-` | Output to stdout |\n| `-layout` | Maintain original layout |\n| `-f \u003Cn>` | Start from page n |\n| `-l \u003Cn>` | End at page n |\n| `-q` | Quiet mode |\n\nExample with options:\n```python\nresult = run_shell(command=f\"pdftotext -layout -q '{pdf_path}' -\", timeout=60)\n```\n\n## Error Handling\n\n```python\nfrom tools import run_shell\n\ndef extract_pdf_text(pdf_path):\n    \"\"\"Extract text from PDF using pdftotext with error handling.\"\"\"\n    import os\n    \n    if not os.path.exists(pdf_path):\n        raise FileNotFoundError(f\"PDF not found: {pdf_path}\")\n    \n    result = run_shell(command=f\"pdftotext '{pdf_path}' -\", timeout=60)\n    \n    if result.returncode != 0:\n        raise RuntimeError(f\"pdftotext failed: {result.stderr}\")\n    \n    return result.stdout.strip()\n```\n\n## When to Use This Pattern\n\n- `read_file` returns binary data, garbled text, or image content for a PDF\n- You need searchable\u002Fprocessable text from PDF documents\n- The PDF contains text (not just scanned images - for those, consider OCR tools)\n\n## Prerequisites\n\n- `pdftotext` must be installed (part of `poppler-utils` on Debian\u002FUbuntu, `poppler` on macOS via Homebrew)\n- Verify availability: `run_shell(command=\"which pdftotext\")`","# PDF Text Extraction via pdftotext\n\n## Problem\n\nWhen using `read_file` on PDF documents, the function may return binary image data or garbled content instead of readable text. This occurs because PDFs can contain scanned images or complex binary structures that `read_file` cannot properly parse as text.\n\n## Solution\n\nUse the `pdftotext` command-line utility via `run_shell` to extract clean text content from PDF files.\n\n## Steps\n\n### 1. Verify PDF file exists\n\n```python\nimport os\n\npdf_path = \"path\u002Fto\u002Fdocument.pdf\"\nif not os.path.exists(pdf_path):\n    raise FileNotFoundError(f\"PDF not found: {pdf_path}\")\n```\n\n### 2. Extract text using pdftotext\n\n```python\nfrom tools import run_shell\n\n# Extract text to stdout\nresult = run_shell(command=f\"pdftotext '{pdf_path}' -\", timeout=60)\npdf_text = result.stdout\n\n# Alternative: extract to a temporary file\ntemp_txt = \"\u002Ftmp\u002Fextracted.txt\"\nrun_shell(command=f\"pdftotext '{pdf_path}' '{temp_txt}'\", timeout=60)\nwith open(temp_txt, 'r') as f:\n    pdf_text = f.read()\n```\n\n### 3. Handle parameter naming carefully\n\nWhen calling `read_file`, be aware of the parameter name:\n- Use `filetype=\"pdf\"` (not `file_type`)\n- Some tool implementations may use different parameter names\n\n```python\n# Correct parameter usage\ncontent = read_file(file_path=\"doc.pdf\", filetype=\"pdf\")\n\n# If this returns binary\u002Fgarbled data, fall back to pdftotext\n```\n\n## Common pdftotext Options\n\n| Option | Description |\n|--------|-------------|\n| `-` | Output to stdout |\n| `-layout` | Maintain original layout |\n| `-f \u003Cn>` | Start from page n |\n| `-l \u003Cn>` | End at page n |\n| `-q` | Quiet mode |\n\nExample with options:\n```python\nresult = run_shell(command=f\"pdftotext -layout -q '{pdf_path}' -\", timeout=60)\n```\n\n## Error Handling\n\n```python\nfrom tools import run_shell\n\ndef extract_pdf_text(pdf_path):\n    \"\"\"Extract text from PDF using pdftotext with error handling.\"\"\"\n    import os\n    \n    if not os.path.exists(pdf_path):\n        raise FileNotFoundError(f\"PDF not found: {pdf_path}\")\n    \n    result = run_shell(command=f\"pdftotext '{pdf_path}' -\", timeout=60)\n    \n    if result.returncode != 0:\n        raise RuntimeError(f\"pdftotext failed: {result.stderr}\")\n    \n    return result.stdout.strip()\n```\n\n## When to Use This Pattern\n\n- `read_file` returns binary data, garbled text, or image content for a PDF\n- You need searchable\u002Fprocessable text from PDF documents\n- The PDF contains text (not just scanned images - for those, consider OCR tools)\n\n## Prerequisites\n\n- `pdftotext` must be installed (part of `poppler-utils` on Debian\u002FUbuntu, `poppler` on macOS via Homebrew)\n- Verify availability: `run_shell(command=\"which pdftotext\")`",{"name":5,"description":7},"main","0650921d63895de3997bc81f1ff1d0ac67032072","gdpval_bench\u002Fskills\u002Fpdf-text-extraction-9424c5","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution","https:\u002F\u002Fgithub.com\u002FUF-gzj","2026-04-16 09:31:03",{"source":8,"skillName":5,"commands":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add UF-gzj\u002Fopenspace-claude-evolution --skill pdf-text-extraction-9424c5",{"tool":54,"command":55},"bunx","bunx skills add UF-gzj\u002Fopenspace-claude-evolution --skill pdf-text-extraction-9424c5",{"tool":57,"command":58},"pnpm","pnpm dlx skills add UF-gzj\u002Fopenspace-claude-evolution --skill pdf-text-extraction-9424c5","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-text-extraction-9424c5\u002FSKILL.md",true,[62],{"path":63,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":67},".skill_id","OTHER","其他",40,"https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-text-extraction-9424c5\u002F.skill_id",[69,92,108,117,146,162],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":37},"01M6XCCXD3NCM2YKR3WNGBASPC","write-special-chars-ts-check","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, plus a reliable TypeScript type-checking step that filters output to only the newly-written files to avoid being misled by pre-existing errors.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[76,77,78,79,80,81,82,83,84,85,86,87,88,33,89,90,28,91],"check","write","write special chars ts check","typescript","filters","characters","Existing","type-checking","for","errors","script","output","type","only","template","python",{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":37},"01M6XCCT7E3J922Q345PBGSHPN","write-special-chars-readback","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, with mandatory post-write verification via read_file and cleanup of \u002Ftmp helper scripts.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[99,100,77,28,101,91,102,103,104,105,31,90,106,107,81,84,86],"readback","write special chars readback","helper","post","via","scripts","cleanup","verification","with",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":37},"01M6XCCMQX1R8B6FECWB3P63T7","write-special-chars-heredoc","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) by using a Python heredoc script executed via shell.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[115,77,81,116,86,103,90,28,91,84],"write special chars heredoc","shell",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":128,"publishedAt":37},"01M6XCCG41M994JJEX6VN52PEP","worldmonitor-reference","Curated architecture index of the WorldMonitor open-source dashboard. Reference for extracting patterns — vanilla TypeScript, Panel class hierarchy, service layer, CSS grid, API edge functions, refresh scheduler, and 60+ data source integrations.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[123],{"categoryNo":124,"categoryName":125,"taxonomyType":126,"taxonomyTypeDesc":127},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[129,130,131,132,133,79,134,135,136,137,138,84,139,140,141,142,143,144,145,29],"reference","worldmonitor","worldmonitor reference","architecture","dashboard","css","scheduler","layer","hierarchy","source","extracting","panel","patterns","edge functions","integrations","open","api",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":37},"01M6XCCCHWNKG2W4VH9E6A10HF","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[153,154,155,156,84,157,107,158,159,160,161],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":163,"name":164,"nameZh":6,"description":165,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":166,"categories":167,"keywords":168,"publishedAt":37},"01M6XCC7X8PKMR2DEW91XGHYSV","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FUF-gzj\u002Fopenspace-claude-evolution\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[169,170,171,172,173,174,28,175,176,177],"directory","verify directory structure","structure","verify","access","first","issues","diagnose","file access"]