Install
openclaw skills install @biabia-55/pdf-ocr-layout-freeFull OCR pipeline for scanned PDFs with layout preservation. Use this skill whenever the user wants to OCR a PDF, convert a scanned document to searchable text, or preserve the original layout of a scanned book/document. Triggers on: "OCR this PDF", "用PaddleOCR处理", "识别这个PDF", "扫描版PDF转文字", "把这个PDF做OCR", or when a PDF path is provided alongside any mention of OCR, text recognition, or layout preservation.
openclaw skills install @biabia-55/pdf-ocr-layout-freeAutomated pipeline: Split → OCR API → Layout PDF → Merge
Each original page becomes one PDF page, with text placed at exact bounding-box positions and font sizes calibrated to fill the original block dimensions.
python ~/.claude/skills/pdf-ocr-layout/scripts/pipeline.py "/path/to/input.pdf"
Output: input_ocr.pdf in the same directory. Intermediate files in input_ocr_work/.
python ~/.claude/skills/pdf-ocr-layout/scripts/pipeline.py \
"/path/to/input.pdf" \
--output "/path/to/output.pdf" \
--work-dir "/path/to/workdir" \
--chunk-size 90
pip install pypdf reportlab Pillow requests -q
python ~/.claude/skills/pdf-ocr-layout/scripts/pipeline.py "{input_pdf}"
The pipeline saves state to the work directory and is fully resumable:
jobs.json — API job IDs (prevents re-submitting already-queued chunks)chunk_*_results.jsonl — cached OCR results (skip re-downloading)chunk_*_ocr.pdf — completed chunk PDFs (skip re-rendering)If interrupted, simply re-run the same command. It picks up where it left off.
| Problem | Fix |
|---|---|
ModuleNotFoundError | Run the pip install command above |
| API 4xx error | Check the PDF isn't password-protected |
Job stuck in running | Normal for large chunks; wait up to 10 min |
| Missing images in output | Images left blank per design (API images are optional) |
| Font too small/large | The font size auto-calibrates — first page may look different if it's a cover |
fs = min(√(h×w / n×0.65), h×0.72)
— verified to recover original ~13–14pt body text