$npx -y skills add axoviq-ai/synthadoc --skill pdfExtract text from PDF documents
| 1 | # PDF Skill |
| 2 | |
| 3 | Extracts text from PDF files using `pypdf` as the primary parser, with |
| 4 | `pdfminer.six` as a fallback for CJK fonts that pypdf cannot decode |
| 5 | (detected when pypdf yields fewer than 50 characters per page on average). |
| 6 | |
| 7 | ## Setup |
| 8 | |
| 9 | ```bash |
| 10 | pip install pypdf pdfminer.six |
| 11 | ``` |
| 12 | |
| 13 | ## Standalone usage |
| 14 | |
| 15 | ```python |
| 16 | import asyncio |
| 17 | from synthadoc.skills.pdf.scripts.main import PdfSkill |
| 18 | |
| 19 | skill = PdfSkill() |
| 20 | |
| 21 | async def main(): |
| 22 | result = await skill.extract("/path/to/paper.pdf") |
| 23 | print(result.text) # extracted text from all pages |
| 24 | print(result.metadata) # {"pages": N, "cjk_fallback": bool, ...} |
| 25 | |
| 26 | asyncio.run(main()) |
| 27 | ``` |
| 28 | |
| 29 | ## When this skill is used |
| 30 | |
| 31 | - Source path ends with `.pdf` |
| 32 | - User intent contains: `pdf`, `research paper` |
| 33 | |
| 34 | ## Scripts |
| 35 | |
| 36 | - `scripts/main.py` — `PdfSkill` class |
| 37 | |
| 38 | ## References |
| 39 | |
| 40 | - `references/cjk-notes.md` — notes on CJK font handling |