[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KJW3JRG54P8WRZS2ESZDV9":3,"skill-same:01M6KJW3JRG54P8WRZS2ESZDV9":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":13,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":6,"ownerDescription":49,"updatedAt":50,"install":51,"resources":64},"01M6KJW3JRG54P8WRZS2ESZDV9","reliable-pdf-extraction-ac5f89",null,"Extract PDF text content using shell tools or Python libraries when read_file PDF handler fails","AG064\u002FOpenSpace","AG064","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184930299?v=4","01M6KHVFG7TB73NHX3RDYSTMH2","01M6KHVFMM7XA2PZA9Z83PHS3V",0,"MIT","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Freliable-pdf-extraction-ac5f89\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,37,38],"PDF","extraction","pdf extraction","reliable pdf extraction ac5f89","reliable pdf extraction","python","libraries","content","file","Tools","shell","text","read","extract","extract pdf","handler","2026-11-10 10:12:30",false,"---\nname: reliable-pdf-extraction-ac5f89\ndescription: Extract PDF text content using shell tools or Python libraries when read_file PDF handler fails\n---\n\n# Reliable PDF Text Extraction\n\n## Problem\n\nThe `read_file` tool with `filetype='pdf'` can be unreliable for PDF text extraction. It may:\n- Return binary image data instead of text\n- Fail with errors on certain PDF structures\n- Lose formatting or structured content\n\n## Solution\n\nUse `run_shell` with dedicated PDF extraction tools instead of relying on `read_file` for PDFs.\n\n## Methods\n\n### Method 1: pdftotext (Recommended)\n\n```bash\npdftotext input.pdf output.txt\n```\n\nOr to extract to stdout:\n```bash\npdftotext input.pdf -\n```\n\nWith layout preservation:\n```bash\npdftotext -layout input.pdf output.txt\n```\n\n### Method 2: pdfinfo (Metadata)\n\n```bash\npdfinfo input.pdf\n```\n\nUseful for checking page count, dimensions, and PDF properties before extraction.\n\n### Method 3: Python with PyMuPDF (fitz)\n\n```python\nimport fitz  # PyMuPDF\n\ndoc = fitz.open(\"input.pdf\")\ntext = \"\"\nfor page in doc:\n    text += page.get_text()\ndoc.close()\n```\n\n### Method 4: Python with pdfplumber (Tables)\n\n```python\nimport pdfplumber\n\nwith pdfplumber.open(\"input.pdf\") as pdf:\n    for page in pdf.pages:\n        text = page.extract_text()\n        tables = page.extract_tables()\n```\n\n## Workflow\n\n1. **Check PDF exists and is readable:**\n   ```bash\n   pdfinfo input.pdf 2>\u002Fdev\u002Fnull || echo \"PDF not accessible\"\n   ```\n\n2. **Extract text using pdftotext:**\n   ```bash\n   pdftotext -layout input.pdf - > extracted_text.txt\n   ```\n\n3. **If pdftotext fails, try Python fallback:**\n   ```python\n   import fitz\n   doc = fitz.open(\"input.pdf\")\n   for i, page in enumerate(doc):\n       print(f\"--- Page {i+1} ---\")\n       print(page.get_text())\n   doc.close()\n   ```\n\n4. **Verify extraction succeeded:**\n   - Check output is non-empty\n   - Verify text is readable (not binary\u002Fgarbled)\n   - Confirm expected content is present\n\n## When to Use\n\n| Tool | Best For |\n|------|----------|\n| `pdftotext` | Fast, simple text extraction |\n| `pdftotext -layout` | Preserving spacing\u002Fformatting |\n| `PyMuPDF` | Complex PDFs, programmatic access |\n| `pdfplumber` | Tables and structured data |\n\n## Example Integration\n\n```bash\n# In your agent workflow, prefer this pattern:\nresult = run_shell(command=\"pdftotext document.pdf -\", timeout=30)\nif result.stdout and len(result.stdout.strip()) > 0:\n    content = result.stdout\nelse:\n    # Fallback to Python\n    content = execute_python_to_extract_pdf(\"document.pdf\")\n```\n\n## Notes\n\n- Install tools if needed: `apt-get install poppler-utils` (for pdftotext\u002Fpdfinfo)\n- Python libraries: `pip install pymupdf pdfplumber`\n- Some PDFs are image-scanned and require OCR (Tesseract) instead\n- Always validate extracted content before proceeding with downstream tasks","# Reliable PDF Text Extraction\n\n## Problem\n\nThe `read_file` tool with `filetype='pdf'` can be unreliable for PDF text extraction. It may:\n- Return binary image data instead of text\n- Fail with errors on certain PDF structures\n- Lose formatting or structured content\n\n## Solution\n\nUse `run_shell` with dedicated PDF extraction tools instead of relying on `read_file` for PDFs.\n\n## Methods\n\n### Method 1: pdftotext (Recommended)\n\n```bash\npdftotext input.pdf output.txt\n```\n\nOr to extract to stdout:\n```bash\npdftotext input.pdf -\n```\n\nWith layout preservation:\n```bash\npdftotext -layout input.pdf output.txt\n```\n\n### Method 2: pdfinfo (Metadata)\n\n```bash\npdfinfo input.pdf\n```\n\nUseful for checking page count, dimensions, and PDF properties before extraction.\n\n### Method 3: Python with PyMuPDF (fitz)\n\n```python\nimport fitz  # PyMuPDF\n\ndoc = fitz.open(\"input.pdf\")\ntext = \"\"\nfor page in doc:\n    text += page.get_text()\ndoc.close()\n```\n\n### Method 4: Python with pdfplumber (Tables)\n\n```python\nimport pdfplumber\n\nwith pdfplumber.open(\"input.pdf\") as pdf:\n    for page in pdf.pages:\n        text = page.extract_text()\n        tables = page.extract_tables()\n```\n\n## Workflow\n\n1. **Check PDF exists and is readable:**\n   ```bash\n   pdfinfo input.pdf 2>\u002Fdev\u002Fnull || echo \"PDF not accessible\"\n   ```\n\n2. **Extract text using pdftotext:**\n   ```bash\n   pdftotext -layout input.pdf - > extracted_text.txt\n   ```\n\n3. **If pdftotext fails, try Python fallback:**\n   ```python\n   import fitz\n   doc = fitz.open(\"input.pdf\")\n   for i, page in enumerate(doc):\n       print(f\"--- Page {i+1} ---\")\n       print(page.get_text())\n   doc.close()\n   ```\n\n4. **Verify extraction succeeded:**\n   - Check output is non-empty\n   - Verify text is readable (not binary\u002Fgarbled)\n   - Confirm expected content is present\n\n## When to Use\n\n| Tool | Best For |\n|------|----------|\n| `pdftotext` | Fast, simple text extraction |\n| `pdftotext -layout` | Preserving spacing\u002Fformatting |\n| `PyMuPDF` | Complex PDFs, programmatic access |\n| `pdfplumber` | Tables and structured data |\n\n## Example Integration\n\n```bash\n# In your agent workflow, prefer this pattern:\nresult = run_shell(command=\"pdftotext document.pdf -\", timeout=30)\nif result.stdout and len(result.stdout.strip()) > 0:\n    content = result.stdout\nelse:\n    # Fallback to Python\n    content = execute_python_to_extract_pdf(\"document.pdf\")\n```\n\n## Notes\n\n- Install tools if needed: `apt-get install poppler-utils` (for pdftotext\u002Fpdfinfo)\n- Python libraries: `pip install pymupdf pdfplumber`\n- Some PDFs are image-scanned and require OCR (Tesseract) instead\n- Always validate extracted content before proceeding with downstream tasks",{"name":5,"description":7},"main","ff671ef61ed6587c49bd54c81cdc751c0b99e363","gdpval_bench\u002Fskills\u002Freliable-pdf-extraction-ac5f89","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace","https:\u002F\u002Fgithub.com\u002FAG064","AG064, E.Mi.\r\n\r\nA person who thinks all the time, yet all they have to think about is nothing. I want to improve the world and work on open source projects","2026-10-08 06:53:48",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add AG064\u002FOpenSpace --skill reliable-pdf-extraction-ac5f89",{"tool":57,"command":58},"bunx","bunx skills add AG064\u002FOpenSpace --skill reliable-pdf-extraction-ac5f89",{"tool":60,"command":61},"pnpm","pnpm dlx skills add AG064\u002FOpenSpace --skill reliable-pdf-extraction-ac5f89","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Freliable-pdf-extraction-ac5f89\u002FSKILL.md",true,[65],{"path":66,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":70},".skill_id","OTHER","其他",44,"https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Freliable-pdf-extraction-ac5f89\u002F.skill_id",[72,94,110,118,148,164],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":39},"01M6KKMPWA0B5SCCH766F8M5EA","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[79,80,81,82,83,84,85,86,87,88,89,90,91,92,31,28,93],"write special chars ts check","check","write","filters","Existing","type-checking","for","errors","script","output","type","files","only","template","typescript",{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":39},"01M6KKMJXVBNVEY3TRK055F4A7","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[101,102,81,92,103,35,31,28,104,105,106,107,108,85,87,109],"readback","write special chars readback","cleanup","scripts","verification","via","post","helper","with",{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":39},"01M6KKMEGX9M9NC105J0W3Q5B9","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[81,117,28,85,106,92,33,31,87],"write special chars heredoc",{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":129,"publishedAt":39},"01M6KKM8EJ2AATVHZBNB916WT0","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\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[124],{"categoryNo":125,"categoryName":126,"taxonomyType":127,"taxonomyTypeDesc":128},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[130,131,132,133,93,134,135,136,137,138,85,139,140,141,142,143,144,145,146,147],"reference","worldmonitor","worldmonitor reference","dashboard","css","architecture","extracting","hierarchy","source","layer","panel","patterns","edge functions","integrations","open","api","data","scheduler",{"skillNo":149,"name":150,"nameZh":6,"description":151,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":152,"categories":153,"keywords":154,"publishedAt":39},"01M6KKM39PHYK627F19GE2B9XN","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[155,156,157,158,85,159,109,160,161,162,163],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":165,"name":166,"nameZh":6,"description":167,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":168,"categories":169,"keywords":170,"publishedAt":39},"01M6KKKY7T2P61Y0JH54CDEJKQ","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[171,172,173,174,175,176,31,177,178,179],"directory","verify","structure","verify directory structure","access","first","issues","diagnose","file access"]