Skip to content

Commit 0da0be3

Browse files
authored
Merge pull request #76 from randlee/feature/docling-pdf-extraction
Add sc-docling-pdf skill package
2 parents 0948db8 + 84b02ad commit 0da0be3

43 files changed

Lines changed: 3410 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude-plugin/marketplace.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,27 @@
122122
],
123123
"category": "tools"
124124
},
125+
{
126+
"name": "sc-docling-pdf",
127+
"source": "./packages/sc-docling-pdf",
128+
"description": "Convert PDF documents to markdown and structured output using the docling CLI. Selects the optimal conversion profile based on document content: clean text, scanned/OCR, rich datasheets with images and tables, complex layouts via VLM, or technical documents with code and formulas. Extracts images as referenced PNG files for viewing. No MCP required — pure CLI workflow for Claude Code.",
129+
"version": "0.1.0",
130+
"author": {
131+
"name": "randlee"
132+
},
133+
"license": "MIT",
134+
"keywords": [
135+
"pdf",
136+
"docling",
137+
"conversion",
138+
"markdown",
139+
"ocr",
140+
"images",
141+
"tables",
142+
"datasheets"
143+
],
144+
"category": "tools"
145+
},
125146
{
126147
"name": "sc-git-worktree",
127148
"source": "./packages/sc-git-worktree",

.claude-plugin/registry.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,32 @@
108108
},
109109
"lastUpdated": "2026-04-29T04:44:47.188514+00:00"
110110
},
111+
{
112+
"name": "sc-docling-pdf",
113+
"version": "0.1.0",
114+
"description": "Convert PDF documents to markdown and structured output using the docling CLI. Selects the optimal conversion profile based on document content: clean text, scanned/OCR, rich datasheets with images and tables, complex layouts via VLM, or technical documents with code and formulas. Extracts images as referenced PNG files for viewing. No MCP required — pure CLI workflow for Claude Code.",
115+
"author": "randlee",
116+
"license": "MIT",
117+
"keywords": [
118+
"pdf",
119+
"docling",
120+
"conversion",
121+
"markdown",
122+
"ocr",
123+
"images",
124+
"tables",
125+
"datasheets"
126+
],
127+
"category": "tools",
128+
"artifacts": {
129+
"commands": 0,
130+
"skills": 1,
131+
"agents": 0,
132+
"scripts": 0,
133+
"schemas": 0
134+
},
135+
"lastUpdated": "2026-05-14T00:00:00.000000+00:00"
136+
},
111137
{
112138
"name": "sc-git-worktree",
113139
"version": "0.12.0",

docs/registries/nuget/registry.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,45 @@
122122
"lastUpdated": "2026-04-29",
123123
"dependents": []
124124
},
125+
"sc-docling-pdf": {
126+
"name": "sc-docling-pdf",
127+
"version": "0.1.0",
128+
"status": "beta",
129+
"tier": 0,
130+
"description": "Convert PDF documents to markdown and structured output using the docling CLI. Selects the optimal conversion profile based on document content: clean text, scanned/OCR, rich datasheets with images and tables, complex layouts via VLM, or technical documents with code and formulas. Extracts images as referenced PNG files for viewing. No MCP required — pure CLI workflow for Claude Code.",
131+
"github": "randlee/synaptic-canvas",
132+
"repo": "https://github.com/randlee/synaptic-canvas",
133+
"path": "packages/sc-docling-pdf",
134+
"readme": "https://raw.githubusercontent.com/randlee/synaptic-canvas/main/packages/sc-docling-pdf/README.md",
135+
"license": "MIT",
136+
"author": {
137+
"name": "randlee"
138+
},
139+
"tags": [
140+
"pdf",
141+
"docling",
142+
"conversion",
143+
"markdown",
144+
"ocr",
145+
"images",
146+
"tables",
147+
"datasheets"
148+
],
149+
"artifacts": {
150+
"commands": 0,
151+
"skills": 1,
152+
"agents": 0,
153+
"scripts": 0,
154+
"schemas": 0
155+
},
156+
"dependencies": [
157+
"python3",
158+
"docling"
159+
],
160+
"changelog": "https://raw.githubusercontent.com/randlee/synaptic-canvas/main/packages/sc-docling-pdf/CHANGELOG.md",
161+
"lastUpdated": "2026-05-14",
162+
"dependents": []
163+
},
125164
"sc-git-worktree": {
126165
"name": "sc-git-worktree",
127166
"version": "0.12.0",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "sc-docling-pdf",
3+
"description": "Convert PDF documents to markdown and structured output using the docling CLI. Selects the optimal conversion profile based on document content: clean text, scanned/OCR, rich datasheets with images and tables, complex layouts via VLM, or technical documents with code and formulas. Extracts images as referenced PNG files for viewing. No MCP required — pure CLI workflow for Claude Code.",
4+
"version": "0.1.0",
5+
"author": {
6+
"name": "randlee"
7+
},
8+
"license": "MIT",
9+
"keywords": [
10+
"pdf",
11+
"docling",
12+
"conversion",
13+
"markdown",
14+
"ocr",
15+
"images",
16+
"tables",
17+
"datasheets"
18+
],
19+
"skills": [
20+
"./skills/docling-pdf-extraction/SKILL.md"
21+
]
22+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: sc-docling-pdf
2+
version: 0.1.0
3+
description: >
4+
Convert PDF documents to markdown and structured output using the docling CLI.
5+
Selects the optimal conversion profile based on document content: clean text,
6+
scanned/OCR, rich datasheets with images and tables, complex layouts via VLM,
7+
or technical documents with code and formulas. Extracts images as referenced
8+
PNG files for viewing. No MCP required — pure CLI workflow for Claude Code.
9+
author: randlee
10+
license: MIT
11+
tags:
12+
- pdf
13+
- docling
14+
- conversion
15+
- markdown
16+
- ocr
17+
- images
18+
- tables
19+
- datasheets
20+
21+
# Files to install (relative to package root)
22+
artifacts:
23+
skills:
24+
- skills/docling-pdf-extraction/SKILL.md
25+
- skills/docling-pdf-extraction/references/installation.md
26+
- skills/docling-pdf-extraction/references/document-analysis.md
27+
- skills/docling-pdf-extraction/references/profile-text.md
28+
- skills/docling-pdf-extraction/references/profile-scan.md
29+
- skills/docling-pdf-extraction/references/profile-rich.md
30+
- skills/docling-pdf-extraction/references/profile-vlm.md
31+
- skills/docling-pdf-extraction/references/profile-code.md
32+
- skills/docling-pdf-extraction/references/output-markdown.md
33+
- skills/docling-pdf-extraction/references/output-images.md
34+
- skills/docling-pdf-extraction/references/output-tables.md
35+
- skills/docling-pdf-extraction/references/output-json.md
36+
37+
# Installation policy
38+
install:
39+
scope: local-only
40+
41+
# Runtime requirements
42+
requires:
43+
cli:
44+
- python >= 3.10
45+
- docling >= 2.90.0 # verified against current CLI/docs on 2026-04-19
46+
optional:
47+
- poppler # pdfinfo, pdfimages, pdftotext — for document analysis
48+
- docling[easyocr,vlm] # for VLM and enrichment-heavy workflows
49+
- peft >= 0.18.1 # required by Granite-based advanced runtime
50+
- transformers < 5.5 # known-good ceiling for Granite chart/VLM runtime in this skill
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
name: docling-pdf-extraction
3+
version: 0.1.0
4+
description: >
5+
Convert PDF documents to markdown, extract images and tables using the docling CLI.
6+
Use when asked to convert a PDF, extract a datasheet, get images from a PDF, or
7+
process any document into structured output. Triggers: 'convert pdf', 'pdf to
8+
markdown', 'extract images from pdf', 'datasheet', 'get tables from pdf',
9+
'extract diagrams'. No MCP required — uses docling CLI only.
10+
entry_point: /docling-pdf
11+
triggers:
12+
- convert pdf
13+
- pdf to markdown
14+
- extract images
15+
- extract tables
16+
- datasheet
17+
- docling
18+
- ocr pdf
19+
---
20+
21+
# Docling PDF Extraction
22+
23+
Convert PDFs to markdown and structured output using the docling CLI.
24+
Selects the optimal conversion profile based on document content.
25+
26+
## Step 1 — Verify Installation and Runtime Compatibility
27+
28+
```bash
29+
which docling && docling --version
30+
```
31+
32+
If not found on PATH, also check common install locations — Claude Code's bash
33+
PATH may differ from the interactive shell:
34+
35+
```bash
36+
for p in "$HOME/.local/bin/docling" "$HOME/.venvs/docling/bin/docling" \
37+
"$(python3 -m site --user-base 2>/dev/null)/bin/docling" \
38+
"/opt/homebrew/bin/docling"; do
39+
[ -x "$p" ] && echo "Found at: $p" && break
40+
done
41+
```
42+
43+
If found at a non-PATH location, use the full path for all `docling` commands,
44+
or export that directory to PATH for the session.
45+
46+
If not installed: **read `references/installation.md` before proceeding.**
47+
48+
On first use in a session, and after any Docling / `transformers` / `peft` upgrade,
49+
run the advanced-runtime validation block from `references/installation.md`.
50+
51+
If validation fails:
52+
- fix the environment before using `vlm` or enrichment-heavy commands
53+
- fall back to `text`, `scan`, or baseline `rich` without enrichment flags
54+
55+
If the document may need OCR:
56+
- read `references/profile-scan.md` before running the command
57+
- be explicit about `--ocr-lang` for the document language; for English-only scans, use `--ocr-lang en`
58+
59+
---
60+
61+
## Step 2 — Analyze the Document
62+
63+
Before choosing a profile, inspect the document to understand its content type.
64+
65+
**Read `references/document-analysis.md`** to determine:
66+
- Is text selectable (digital) or bitmapped (scanned)?
67+
- Are there tables? Images? Diagrams? Charts? Code? Math?
68+
- Is the layout simple or complex (multi-column, dense mixed content)?
69+
70+
---
71+
72+
## Step 3 — Select a Conversion Profile
73+
74+
| Profile | Document Type | Speed / Quality | Reference |
75+
|---------|--------------|-----------------|-----------|
76+
| `text` | Digital PDF, prose only, no images needed | Fastest, lowest overhead | `references/profile-text.md` |
77+
| `scan` | Scanned or photographed, bitmapped text | Slower; OCR-first | `references/profile-scan.md` |
78+
| `rich` | Datasheet, spec sheet, tables + photographs + diagrams ⭐ | Best default: quick and thorough | `references/profile-rich.md` |
79+
| `vlm` | Complex layout, dense mixed content, poor standard results | Slowest, highest layout recovery | `references/profile-vlm.md` |
80+
| `code` | Technical docs with code blocks or math formulas | Moderate cost, structure-focused | `references/profile-code.md` |
81+
82+
**Tie-breaking rules:**
83+
- Prefer `rich` over `text` — it's a superset with minimal overhead
84+
- Prefer `rich` over `vlm` — VLM is 3–10× slower; only escalate when standard output is poor
85+
- Profiles can be combined: `scan` + `rich` flags are additive
86+
87+
### Runtime Guide
88+
89+
Use this rule of thumb when choosing between "usable now" and "best quality later":
90+
91+
| Need | Recommended path |
92+
|------|------------------|
93+
| Clean text fast | `text` |
94+
| Engineering PDF with tables / images, good enough for most agents | baseline `rich` |
95+
| Scan / photo, readable text first | `scan` |
96+
| Code / math fidelity matters | `code` |
97+
| Layout is wrong or content is missing after baseline `rich` / `scan` | `vlm` with `smoldocling` first |
98+
| Final pass for hardest layouts when runtime is acceptable | `vlm` with `granite_docling` |
99+
100+
Practical timing guidance from local runs:
101+
- `text`: seconds
102+
- baseline `rich`: tens of seconds
103+
- `scan`: tens of seconds to a few minutes
104+
- `smoldocling`: minutes
105+
- `granite_docling`: usually the longest path; reserve for cases where the faster paths are not good enough
106+
107+
---
108+
109+
## Step 4 — Select Output Format(s)
110+
111+
Output format is independent of conversion profile. Multiple formats can be generated in one run.
112+
113+
| Need | Reference |
114+
|------|-----------|
115+
| LLM consumption, reading in editor | `references/output-markdown.md` |
116+
| Viewing extracted photographs and diagrams | `references/output-images.md` |
117+
| Working with tables or chart data | `references/output-tables.md` |
118+
| Structured access, metadata, bounding boxes | `references/output-json.md` |
119+
120+
---
121+
122+
## Quick Reference
123+
124+
```bash
125+
# Fastest — clean digital PDF
126+
docling INPUT.pdf --to md --output ./out --device mps
127+
128+
# Quick, thorough default for engineering PDFs
129+
docling INPUT.pdf --to md --to json --output ./out \
130+
--image-export-mode referenced \
131+
--table-mode accurate --device mps
132+
133+
# Slower, richer variant after Step 1 validation passes
134+
# --enrich-picture-classes --enrich-picture-description --enrich-chart-extraction
135+
136+
# Scanned document: usable OCR text without bloated Markdown
137+
docling INPUT.pdf --to md --output ./out \
138+
--force-ocr --ocr-engine easyocr --ocr-lang en \
139+
--image-export-mode placeholder --device mps
140+
141+
# Complex layout rescue: try Smol first, Granite only if needed
142+
# docling INPUT.pdf --pipeline vlm --vlm-model smoldocling --to md --to json ...
143+
# docling INPUT.pdf --pipeline vlm --vlm-model granite_docling --to md --to json ...
144+
```
145+
146+
For all other cases, follow Steps 1–4 above.

0 commit comments

Comments
 (0)