pdfium-agents-orchestrator
This is the routing skill for the pdfium-render skill package. It does not teach
a single API area; it maps a PDF goal onto the other 25 skills and the order to
apply them. Use it first, then follow it into the specific skills it names.
Default API surface for the whole package: pdfium-render 0.9.x. The 0.8.x line
is covered as version notes inside each skill.
The canonical pipeline
Every pdfium-render program follows the same five stages. ALWAYS run them in
this order.
1. BIND load the PDFium library once
2. LOAD open or create a PdfDocument
3. PAGES reach the page collection
4. PROCESS render / extract / edit / fill / merge / inspect
5. OUTPUT save the document or export an image
| Stage |
Owning skill |
Anchor API |
| 1 BIND |
pdfium-core-bindings-setup |
Pdfium::default(), bind_to_library |
| 2 LOAD |
pdfium-syntax-document-loading |
load_pdf_from_file, create_new_pdf |
| 3 PAGES |
pdfium-syntax-pages |
document.pages(), pages_mut() |
| 4 PROCESS |
depends on goal (see decision tree) |
varies |
| 5 OUTPUT |
pdfium-impl-saving or pdfium-impl-output-formats |
save_to_file, as_image |
Stage 4 is the only branching stage. Stages 1, 2, 3, and 5 are the same shape
for every task.
Goal-to-skill decision tree
What is the PDF goal?
|
+-- Render a page to a PNG or JPEG image?
| LOAD -> pdfium-syntax-pages -> pdfium-syntax-rendering
| -> pdfium-impl-output-formats
|
+-- Extract the text of a page or document?
| LOAD -> pdfium-syntax-pages -> pdfium-syntax-text
|
+-- Search for a phrase inside a PDF?
| LOAD -> pdfium-syntax-pages -> pdfium-syntax-text (search)
|
+-- Inspect what objects a page contains?
| LOAD -> pdfium-syntax-pages -> pdfium-syntax-page-objects
|
+-- Add or edit text/image/shape content on a page?
| LOAD -> pdfium-impl-page-objects-edit -> pdfium-impl-saving
|
+-- Fill in a PDF form?
| LOAD -> pdfium-impl-form-fields -> pdfium-impl-saving
|
+-- Add a comment, highlight, stamp, or link annotation?
| LOAD -> pdfium-impl-annotations -> pdfium-impl-saving
|
+-- Add, delete, rotate, or crop whole pages?
| LOAD -> pdfium-impl-page-manipulation -> pdfium-impl-saving
|
+-- Merge, split, extract, or reorder pages across files?
| LOAD -> pdfium-impl-multi-page -> pdfium-impl-saving
|
+-- Create a new PDF from scratch?
| pdfium-syntax-document-loading (create_new_pdf)
| -> pdfium-impl-page-manipulation -> pdfium-impl-page-objects-edit
| -> pdfium-impl-saving
|
+-- Embed or inspect fonts?
| LOAD -> pdfium-impl-fonts
|
+-- Read bookmarks, links, or the table of contents?
| LOAD -> pdfium-impl-navigation
|
+-- Read or change metadata, attachments, permissions, signatures?
| LOAD -> pdfium-impl-document-features -> pdfium-impl-saving
|
+-- Run pdfium-render in a browser?
| pdfium-impl-wasm (changes BIND and LOAD)
|
+-- The program is slow or processes many PDFs?
| pdfium-impl-performance
|
+-- Call a raw FPDF_* function the wrapper does not expose?
| pdfium-core-raw-ffi
|
+-- The library will not load or crashes at bind time?
| pdfium-errors-binding
|
+-- A runtime error, panic, or wrong colors?
pdfium-errors-runtime
The 26-skill map
core/ : cross-cutting concerns
| Skill |
When to reach for it |
pdfium-core-architecture |
understand the ownership tree and runtime model |
pdfium-core-bindings-setup |
STAGE 1: bind functions, binaries, feature flags |
pdfium-core-coordinates |
PdfPoints vs Pixels, PdfRect vs PdfQuadPoints |
pdfium-core-memory |
drop order, lifetimes, self-referential struct trap |
pdfium-core-raw-ffi |
escape hatch: raw FPDF_* calls |
syntax/ : API syntax and reading
| Skill |
When to reach for it |
pdfium-syntax-document-loading |
STAGE 2: open or create a document |
pdfium-syntax-pages |
STAGE 3: reach and iterate pages |
pdfium-syntax-rendering |
STAGE 4: render a page to a PdfBitmap |
pdfium-syntax-text |
STAGE 4: extract and search text |
pdfium-syntax-page-objects |
STAGE 4: read and inspect page objects |
impl/ : development workflows
| Skill |
When to reach for it |
pdfium-impl-page-objects-edit |
STAGE 4: create and transform page objects |
pdfium-impl-output-formats |
STAGE 5: bitmap to PNG, JPEG, raw bytes |
pdfium-impl-annotations |
STAGE 4: read, modify, create annotations |
pdfium-impl-form-fields |
STAGE 4: fill form fields |
pdfium-impl-page-manipulation |
STAGE 4: add, delete, rotate, crop pages |
pdfium-impl-multi-page |
STAGE 4: merge, split, reorder across documents |
pdfium-impl-saving |
STAGE 5: save a document to file, writer, bytes |
pdfium-impl-fonts |
STAGE 4: embed and inspect fonts |
pdfium-impl-navigation |
STAGE 4: bookmarks, links, destinations |
pdfium-impl-document-features |
STAGE 4: metadata, attachments, permissions |
pdfium-impl-wasm |
browser target: changes binding and loading |
pdfium-impl-performance |
scaling: bind once, threading, render cost |
errors/ : diagnosis
| Skill |
When to reach for it |
pdfium-errors-binding |
STAGE 1 failed: LoadLibraryError diagnosis |
pdfium-errors-runtime |
a PdfiumError at run time, wrong byte order |
agents/ : orchestration
| Skill |
When to reach for it |
pdfium-agents-orchestrator |
this skill: route a goal to the right skills |
pdfium-agents-validator |
review generated pdfium-render code for correctness |
Cross-skill consistency rules
These rules hold across every skill. Enforce them when composing a pipeline.
- ALWAYS target one version line. Default to 0.9.x. NEVER mix a removed 0.8.x
name (
PdfBitmapConfig, get_bitmap, as_bytes, set_matrix,
load_pdf_from_bytes, get_bindings, PdfBitmapRotation, direct PdfFont
constructors, copy_onto_new_page_*) with the 0.9.x API in one program.
- ALWAYS bind PDFium once. In a loop, a server, or a batch job, reuse one
Pdfium instance. See pdfium-impl-performance.
- ALWAYS respect the ownership tree: a
PdfPage cannot outlive its
PdfDocument, which cannot outlive its Pdfium. See pdfium-core-memory.
- ALWAYS save after any edit. Render, extraction, and inspection produce output
directly; create, edit, fill, annotate, and merge all need an explicit
pdfium-impl-saving step or the changes are lost.
- ALWAYS keep coordinate units straight: page geometry is
PdfPoints, bitmap
geometry is Pixels. See pdfium-core-coordinates.
- After generating a pdfium-render program, route through
pdfium-agents-validator to check it against the removed-name and
consistency checklist.
Pipeline patterns
The verified end-to-end code for each pattern is in references/examples.md.
- Render to image: bind, load, iterate pages,
render_with_config, as_image,
save the image.
- Extract text: bind, load, iterate pages,
text(), all().
- Edit and save: bind, load, edit via the page-objects or annotations skill,
save_to_file.
- Merge documents: bind,
create_new_pdf, append each source, save_to_file.
Critical rules
- ALWAYS start a pdfium-render task here, then follow the decision tree into
the specific skill.
- ALWAYS run the five pipeline stages in order: bind, load, pages, process,
output.
- NEVER reach for
pdfium-core-raw-ffi when a high-level skill covers the goal.
Raw FFI is the escape hatch, not the default.
- NEVER skip the output stage after an editing process.
- For a browser target, route through
pdfium-impl-wasm first; it changes the
bind and load stages.
Companion skills
This skill maps all 25 other skills in the package. It is the entry point;
every other skill is a companion. pdfium-agents-validator is its review
counterpart.
Reference files
references/methods.md : the API-anchor to skill-owner map.
references/examples.md : verified end-to-end pipeline examples.
references/anti-patterns.md : orchestration mistakes and the fix.
1---2name: pdfium-agents-orchestrator3description: Use when starting any pdfium-render task and a PDF goal must be routed to the right skills in the right order: this is the entry-point routing skill that lays out the canonical pipeline (bind, load, reach pages, process, save or export). Prevents the wrong-skill mistake (reaching for a low-level skill when a goal skill exists), the wrong-order mistake (processing before binding or saving before processing), and the version-drift mistake (mixing 0.8.x and 0.9.x API names in one program). Covers the full 26-skill map, goal-to-skill decision trees, the pipeline stages, and the cross-skill consistency rules. Keywords: pdfium-render where do I start, which pdfium skill, PDF pipeline, render PDF, extract text from PDF, fill PDF form, merge PDFs, annotate PDF, create PDF, pdfium routing, pdfium workflow, how do I process a PDF in Rust, pdfium getting started, pdfium task plan4license: MIT5---67# pdfium-agents-orchestrator89This is the routing skill for the pdfium-render skill package. It does not teach10a single API area; it maps a PDF goal onto the other 25 skills and the order to11apply them. Use it first, then follow it into the specific skills it names.1213Default API surface for the whole package: pdfium-render 0.9.x. The 0.8.x line14is covered as version notes inside each skill.1516## The canonical pipeline1718Every pdfium-render program follows the same five stages. ALWAYS run them in19this order.2021```221. BIND load the PDFium library once232. LOAD open or create a PdfDocument243. PAGES reach the page collection254. PROCESS render / extract / edit / fill / merge / inspect265. OUTPUT save the document or export an image27```2829| Stage | Owning skill | Anchor API |30|-------|--------------|------------|31| 1 BIND | `pdfium-core-bindings-setup` | `Pdfium::default()`, `bind_to_library` |32| 2 LOAD | `pdfium-syntax-document-loading` | `load_pdf_from_file`, `create_new_pdf` |33| 3 PAGES | `pdfium-syntax-pages` | `document.pages()`, `pages_mut()` |34| 4 PROCESS | depends on goal (see decision tree) | varies |35| 5 OUTPUT | `pdfium-impl-saving` or `pdfium-impl-output-formats` | `save_to_file`, `as_image` |3637Stage 4 is the only branching stage. Stages 1, 2, 3, and 5 are the same shape38for every task.3940## Goal-to-skill decision tree4142```43What is the PDF goal?44|45+-- Render a page to a PNG or JPEG image?46| LOAD -> pdfium-syntax-pages -> pdfium-syntax-rendering47| -> pdfium-impl-output-formats48|49+-- Extract the text of a page or document?50| LOAD -> pdfium-syntax-pages -> pdfium-syntax-text51|52+-- Search for a phrase inside a PDF?53| LOAD -> pdfium-syntax-pages -> pdfium-syntax-text (search)54|55+-- Inspect what objects a page contains?56| LOAD -> pdfium-syntax-pages -> pdfium-syntax-page-objects57|58+-- Add or edit text/image/shape content on a page?59| LOAD -> pdfium-impl-page-objects-edit -> pdfium-impl-saving60|61+-- Fill in a PDF form?62| LOAD -> pdfium-impl-form-fields -> pdfium-impl-saving63|64+-- Add a comment, highlight, stamp, or link annotation?65| LOAD -> pdfium-impl-annotations -> pdfium-impl-saving66|67+-- Add, delete, rotate, or crop whole pages?68| LOAD -> pdfium-impl-page-manipulation -> pdfium-impl-saving69|70+-- Merge, split, extract, or reorder pages across files?71| LOAD -> pdfium-impl-multi-page -> pdfium-impl-saving72|73+-- Create a new PDF from scratch?74| pdfium-syntax-document-loading (create_new_pdf)75| -> pdfium-impl-page-manipulation -> pdfium-impl-page-objects-edit76| -> pdfium-impl-saving77|78+-- Embed or inspect fonts?79| LOAD -> pdfium-impl-fonts80|81+-- Read bookmarks, links, or the table of contents?82| LOAD -> pdfium-impl-navigation83|84+-- Read or change metadata, attachments, permissions, signatures?85| LOAD -> pdfium-impl-document-features -> pdfium-impl-saving86|87+-- Run pdfium-render in a browser?88| pdfium-impl-wasm (changes BIND and LOAD)89|90+-- The program is slow or processes many PDFs?91| pdfium-impl-performance92|93+-- Call a raw FPDF_* function the wrapper does not expose?94| pdfium-core-raw-ffi95|96+-- The library will not load or crashes at bind time?97| pdfium-errors-binding98|99+-- A runtime error, panic, or wrong colors?100 pdfium-errors-runtime101```102103## The 26-skill map104105### core/ : cross-cutting concerns106107| Skill | When to reach for it |108|-------|----------------------|109| `pdfium-core-architecture` | understand the ownership tree and runtime model |110| `pdfium-core-bindings-setup` | STAGE 1: bind functions, binaries, feature flags |111| `pdfium-core-coordinates` | `PdfPoints` vs `Pixels`, `PdfRect` vs `PdfQuadPoints` |112| `pdfium-core-memory` | drop order, lifetimes, self-referential struct trap |113| `pdfium-core-raw-ffi` | escape hatch: raw `FPDF_*` calls |114115### syntax/ : API syntax and reading116117| Skill | When to reach for it |118|-------|----------------------|119| `pdfium-syntax-document-loading` | STAGE 2: open or create a document |120| `pdfium-syntax-pages` | STAGE 3: reach and iterate pages |121| `pdfium-syntax-rendering` | STAGE 4: render a page to a `PdfBitmap` |122| `pdfium-syntax-text` | STAGE 4: extract and search text |123| `pdfium-syntax-page-objects` | STAGE 4: read and inspect page objects |124125### impl/ : development workflows126127| Skill | When to reach for it |128|-------|----------------------|129| `pdfium-impl-page-objects-edit` | STAGE 4: create and transform page objects |130| `pdfium-impl-output-formats` | STAGE 5: bitmap to PNG, JPEG, raw bytes |131| `pdfium-impl-annotations` | STAGE 4: read, modify, create annotations |132| `pdfium-impl-form-fields` | STAGE 4: fill form fields |133| `pdfium-impl-page-manipulation` | STAGE 4: add, delete, rotate, crop pages |134| `pdfium-impl-multi-page` | STAGE 4: merge, split, reorder across documents |135| `pdfium-impl-saving` | STAGE 5: save a document to file, writer, bytes |136| `pdfium-impl-fonts` | STAGE 4: embed and inspect fonts |137| `pdfium-impl-navigation` | STAGE 4: bookmarks, links, destinations |138| `pdfium-impl-document-features` | STAGE 4: metadata, attachments, permissions |139| `pdfium-impl-wasm` | browser target: changes binding and loading |140| `pdfium-impl-performance` | scaling: bind once, threading, render cost |141142### errors/ : diagnosis143144| Skill | When to reach for it |145|-------|----------------------|146| `pdfium-errors-binding` | STAGE 1 failed: `LoadLibraryError` diagnosis |147| `pdfium-errors-runtime` | a `PdfiumError` at run time, wrong byte order |148149### agents/ : orchestration150151| Skill | When to reach for it |152|-------|----------------------|153| `pdfium-agents-orchestrator` | this skill: route a goal to the right skills |154| `pdfium-agents-validator` | review generated pdfium-render code for correctness |155156## Cross-skill consistency rules157158These rules hold across every skill. Enforce them when composing a pipeline.159160- ALWAYS target one version line. Default to 0.9.x. NEVER mix a removed 0.8.x161 name (`PdfBitmapConfig`, `get_bitmap`, `as_bytes`, `set_matrix`,162 `load_pdf_from_bytes`, `get_bindings`, `PdfBitmapRotation`, direct `PdfFont`163 constructors, `copy_onto_new_page_*`) with the 0.9.x API in one program.164- ALWAYS bind PDFium once. In a loop, a server, or a batch job, reuse one165 `Pdfium` instance. See `pdfium-impl-performance`.166- ALWAYS respect the ownership tree: a `PdfPage` cannot outlive its167 `PdfDocument`, which cannot outlive its `Pdfium`. See `pdfium-core-memory`.168- ALWAYS save after any edit. Render, extraction, and inspection produce output169 directly; create, edit, fill, annotate, and merge all need an explicit170 `pdfium-impl-saving` step or the changes are lost.171- ALWAYS keep coordinate units straight: page geometry is `PdfPoints`, bitmap172 geometry is `Pixels`. See `pdfium-core-coordinates`.173- After generating a pdfium-render program, route through174 `pdfium-agents-validator` to check it against the removed-name and175 consistency checklist.176177## Pipeline patterns178179The verified end-to-end code for each pattern is in `references/examples.md`.180181- Render to image: bind, load, iterate pages, `render_with_config`, `as_image`,182 save the image.183- Extract text: bind, load, iterate pages, `text()`, `all()`.184- Edit and save: bind, load, edit via the page-objects or annotations skill,185 `save_to_file`.186- Merge documents: bind, `create_new_pdf`, `append` each source, `save_to_file`.187188## Critical rules189190- ALWAYS start a pdfium-render task here, then follow the decision tree into191 the specific skill.192- ALWAYS run the five pipeline stages in order: bind, load, pages, process,193 output.194- NEVER reach for `pdfium-core-raw-ffi` when a high-level skill covers the goal.195 Raw FFI is the escape hatch, not the default.196- NEVER skip the output stage after an editing process.197- For a browser target, route through `pdfium-impl-wasm` first; it changes the198 bind and load stages.199200## Companion skills201202This skill maps all 25 other skills in the package. It is the entry point;203every other skill is a companion. `pdfium-agents-validator` is its review204counterpart.205206## Reference files207208- `references/methods.md` : the API-anchor to skill-owner map.209- `references/examples.md` : verified end-to-end pipeline examples.210- `references/anti-patterns.md` : orchestration mistakes and the fix.