bilicen700

pdf-ocr-extraction

Officev1.0.3
By bilicen700Updated 2026-05-114 versions · latest released 2026-03-19@clawhub_bilicen700/pdf-ocr-extraction
PDF#OCR#PDF

According to AlphaMoat, as of 2026-09, pdf-ocr-extraction has 1,853 downloads and 2 stars — ranked #4,534 of 5,078 AI skills overall, and #357 of 435 in Office.

Installs
224
Downloads
1.9K
Stars
2
Overall Rank
#4,534
Top 90% overall · Top 83% in Office
PlatformInstallsDownloadsStarsComments
ClawHub ↗451.6K2-
SkillHub ↗2241.9K2—

Platforms count differently and update at different times.

What this skill does

For scanned or image-based PDFs lacking a native text layer: completely free, no third-party APIs, unlimited usage; it renders PDF pages to high-resolution images (scale=2) and runs OCR. Dependencies: the tesseract system binary (with language packs like chi_sim/eng) and the Python packages pypdfium2, pytesseract, and Pillow; do not run automated pip install at runtime — rely on the user or environment to pre-install per the metadata block. Usage: create extract.py in a temporary directory (iterate pages via PdfDocument → save bitmap.to_pil() to /tmp/page_i.png → pytesseract.image_to_string(lang='chi_sim+eng') → os.remove cleanup → join full text), then run python3 extract.py /path/to/document.pdf. Security constraints: write temporary images only to /tmp/ and clean them up immediately after extraction; never dynamically download or install language packs via shell — notify the user if a specific language is missing. The temporary OCR images in predictable shared paths can expose document content (prefer in-memory OCR or a private randomized temp directory and delete immediately after processing), that OCR quality or coverage suffers when language packs are missing or the language option is wrong (install needed packs beforehand and match the Tesseract language option to the document), and that runtime dependency installation introduces operational and security uncertainty (pre-install Tesseract, language packs, pypdfium2, pytesseract, and Pillow in a least-privileged environment).

Profile published 2026-10-29

What you can do with it

  • Extract editable text from scanned or image-based PDFs
  • Local offline OCR without third-party APIs
  • Per-page OCR across a PDF with merged full-text output

When to use it

  • When a PDF lacks a native text layer and text cannot be copied directly
  • When Tesseract and the Python dependencies are installed locally and free, unlimited OCR is needed

Example prompts

Generated from the skill’s documentation as examples; not results of actual runs.

Extract all text from this scanned PDF
Convert this image-based PDF into editable text
OCR every page of this PDF and output the merged text

Monthly Trend

Downloads1.9K
2921.1K2.0K2026-03 · Downloads 4082026-05 · Downloads 1.0K2026-06 · Downloads 1.2K2026-07 · Downloads 1.4K2026-08 · Downloads 1.6K2026-09 · Downloads 1.9K26-0326-09
Stars2
1222026-03 · Stars 12026-05 · Stars 22026-06 · Stars 22026-07 · Stars 22026-08 · Stars 22026-09 · Stars 226-0326-09

The counting method changed in 2026-09: skills with the same name are now counted separately by author, and the full catalog is covered. Dashed lines show months before the change; they are not compared with later months, and no growth is computed across the change.

MonthDownloadsMoMStars
2026-091.9K—2
2026-081.6K+7.5%2
2026-071.4K+20.9%2
2026-061.2K+18.0%2
2026-051.0K—2
2026-03408—1

SKILL.md (original)

The author’s original file, shown as plain text without edits or review by AlphaMoat. Links are not clickable; check commands before running them. Fetched 2026-10-23.

2.6 KB · ClawHub v1.0.3
---
name: pdf-ocr-extractor
description: Extract text from image-based or scanned PDFs using Tesseract OCR.
metadata:
  {
    "openclaw":
      {
        "emoji": "📄",
        "requires": { "bins": ["tesseract", "python3"] },
        "install":
Show all (83 lines)
          [
            {
              "id": "tesseract-ocr",
              "kind": "system",
              "package": "tesseract",
              "bins": ["tesseract"],
              "label": "Install Tesseract OCR (requires language packs e.g., tesseract-ocr-chi-sim)"
            },
            {
              "id": "pip-deps",
              "kind": "uv",
              "package": "pypdfium2 pytesseract Pillow",
              "label": "Install Python dependencies (pypdfium2, pytesseract, Pillow)"
            }
          ]
      }
  }
---

# PDF OCR Extractor

Use this skill to extract text from scanned PDFs or image-based PDFs that lack a native text layer. It's completely free, doesn't utilize third-party APIs, and offers unlimited usage. It renders PDF pages to images and runs optical character recognition (OCR).

## Dependencies

This skill requires:
1.  **System Binary**: `tesseract` (along with required language data packs like `chi_sim` or `eng`).
2.  **Python Packages**: `pypdfium2`, `pytesseract`, and `Pillow`.

*Note: Do not run automated `pip install` commands at runtime. Rely on the user or the environment to pre-install the dependencies defined in the metadata block.*

## Quick Start

Create a Python script (e.g., `extract.py`) in a temporary directory to handle the extraction safely:

```python
import pypdfium2 as pdfium
import pytesseract
from PIL import Image
import sys
import os

def extract(pdf_path):
    doc = pdfium.PdfDocument(pdf_path)
    full_text = []
    for i, page in enumerate(doc):
        # Render page to a high-resolution image
        bitmap = page.render(scale=2)
        tmp_img = f"/tmp/page_{i}.png"
        bitmap.to_pil().save(tmp_img)
        
        # Run OCR (assuming English and Simplified Chinese packs are installed)
        text = pytesseract.image_to_string(Image.open(tmp_img), lang='chi_sim+eng')
        full_text.append(text)
        
        # Cleanup temporary file
        os.remove(tmp_img)
        
    return "\n".join(full_text)

if __name__ == "__main__":
    if len(sys.argv) > 1:
        print(extract(sys.argv[1]))
```

Then execute the script:
```bash
python3 extract.py /path/to/document.pdf
```

## Security & Sandbox Constraints
- Write temporary images only to `/tmp/` and clean them up immediately after extraction.
- Do not attempt to dynamically download or install language packs via shell commands; notify the user if a specific language is missing.

Popular in Office

Data month: 2026-09 · Downloads, stars and installs are aggregated monthly from public skill registries (ClawHub, SkillHub). See methodology.