paddle-ocr

Convert legal PDFs and scanned images to Markdown using the PaddleOCR document parsing API.

636|91|Updated Jan 7, 2026
One-click install
npx skills add https://github.com/cat-xierluo/legal-skills --skill paddle-ocr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: paddle-ocr
Source: https://github.com/cat-xierluo/legal-skills/tree/main/skills/paddle-ocr
Command: npx skills add https://github.com/cat-xierluo/legal-skills --skill paddle-ocr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires httpx, pypdfium2, Pillow, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Legal professionals often receive case files, medical records, evidence scans, and invoices as scanned PDFs or images that cannot be searched or edited. This Skill converts those documents into editable Markdown while preserving a full archive of the original file, structured JSON, and per-batch results for review and traceability.

Core Features & Use Cases

  • Legal Document OCR: Converts local PDFs and images (PNG, JPG, TIFF, etc.) into Markdown via the PaddleOCR layout-parsing API, handling tables, formulas, multi-column layouts, and complex scanned pages.
  • Automatic Batching for Large Files: Splits long case files by page count or estimated payload size, then merges results into a single Markdown document.
  • Traceable Archive: Stores the input file, result.md, result.json, batch-level JSON, extracted images, and metadata.json under an archive directory for later verification.
  • Use Case: A lawyer receives a 200-page scanned case dossier. The Skill automatically splits it into batches, calls the PaddleOCR API, merges the output into one Markdown file, and archives every batch response so OCR quality can be audited later.

Quick Start

Ask the AI to convert a local legal PDF such as case-file.pdf into Markdown with the paddle-ocr skill, optionally limiting the page range.

Frequently Asked Questions about paddle-ocr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert a scanned PDF to Markdown with PaddleOCR?

Run the convert.py script with the PDF path after configuring PADDLEOCR_DOC_PARSING_API_URL and PADDLEOCR_ACCESS_TOKEN in config/.env. The script calls the PaddleOCR layout-parsing API and writes a Markdown file next to the source document.

How do I OCR only specific pages of a large PDF?

Pass a page range such as --pages "1-20" or "1-5,8,10-12" to the convert script. The tool extracts only those pages with pypdfium2 before sending them to the API, reducing upload size and failure risk.

Does PaddleOCR handle large PDFs with hundreds of pages?

Yes. When a PDF exceeds the configured batch page threshold (default 40 pages) or estimated Base64 size limit (default 20 MB), the script automatically splits it into batches, processes each one, and merges the results into a single Markdown file.

Why does the PaddleOCR conversion fail with a 403 error?

A 403 response means the access token is invalid or expired. Update PADDLEOCR_ACCESS_TOKEN in config/.env with a fresh token from the PaddleOCR website, then run the smoke test script to verify connectivity.

When should I not use PaddleOCR for document conversion?

Avoid it for quickly reading a short, clear text snippet where Markdown output and archiving are unnecessary, or when the input is not a PDF or common image format. DOCX and PPTX files are not supported by this API path.