hashgraph-online/awesome-codex-plugins / plugins/alpoxdev/hypercore/skills/hyper-pdf
hyper-pdf
VerifiedUse this skill when the user asks to read, extract from, or produce a PDF - text, tables, images, metadata, form fields, OCR of a scan, merge, split, rotate, watermark, encrypt, or a Korean contract, invoice, or report - and wants the result verified rather than assumed. Two generation paths with an explicit routing rule, a zero-dependency macOS runtime, and checks for font embedding, language tag, and structure tree. Do not use for Word or HWP documents, screenshots, slide decks, or numeric charts.
| File | Kind | Size |
|---|---|---|
| SKILL.ko.md | markdown | 14.9 KB |
| SKILL.md | skill md | 14.3 KB |
| assets/evals/hyper-pdf-cases.jsonl | other | 14.2 KB |
| assets/runtime/compose.js | script | 13.0 KB |
| assets/runtime/engine.js | script | 32.2 KB |
| assets/runtime/native.js | script | 35.4 KB |
| references/commands.ko.md | markdown | 9.9 KB |
| references/commands.md | markdown | 9.5 KB |
| references/layout-spec.ko.md | markdown | 8.2 KB |
| references/layout-spec.md | markdown | 7.6 KB |
| rules/accessibility.ko.md | markdown | 5.3 KB |
| rules/accessibility.md | markdown | 4.9 KB |
| rules/extraction.ko.md | markdown | 6.1 KB |
| rules/extraction.md | markdown | 5.6 KB |
| rules/html-to-pdf.ko.md | markdown | 6.6 KB |
| rules/html-to-pdf.md | markdown | 6.1 KB |
| rules/korean-typesetting.ko.md | markdown | 5.8 KB |
| rules/korean-typesetting.md | markdown | 5.5 KB |
| rules/ocr.ko.md | markdown | 4.0 KB |
| rules/ocr.md | markdown | 3.7 KB |
| rules/research-notes.ko.md | markdown | 8.1 KB |
| rules/research-notes.md | markdown | 7.9 KB |
| rules/verification.ko.md | markdown | 3.9 KB |
| rules/verification.md | markdown | 3.8 KB |
rules/extraction.md
View on GitHub# Text, table, and image extraction
> Read the page as it was built, not as it looks. Extraction quality is decided by the drawing operators, and the recovery strategy must follow them.
## 1. Decide the class first
`check` and `info` classify the document before any extraction runs. The class decides which method can work.
| Signal | Class | Consequence |
|---|---|---|
| `pageText` returns more than a few characters per page | Digital text | Extract directly; every character is real |
| Text is present but `inkRatio` is high on the same page | Text over a scanned background | Extract text, treat the background as decoration |
| `pageText` near zero and the page has ink | Scan | Only `ocr` can produce text |
| `FONT_NOT_EMBEDDED` plus `TYPE3_GLYPHS` | Substituted faces | Extracted characters may be right while the visual is wrong; report both |
| `/Encrypt` in the trailer | Encrypted | `blocked ENCRYPTED`; stop and ask for the password |
Never run OCR on a page that already has a text layer. It doubles the file and puts a second, slightly different string over the real one, which breaks search and screen readers.
## 2. Text extraction
```
engine.js text <file> [--pages 1-5] [--runs] [--json]
```
- Default returns whole-document text in reading order per page.
- `--runs` returns each text-showing operation with its position, font, and size. This is what you need when a paragraph is split across two columns, a header repeats on every page, or a table cell is visually one line but three runs.
- Reading order comes from the content stream, not from visual position. A PDF built poorly can emit a right column before a left column. When order looks wrong, sort the `--runs` output by `y` descending then `x` ascending and rebuild the lines yourself.
- Ligature and soft hyphen handling: a word broken across lines arrives with no hyphen or with a hyphen that is not part of the word. Rejoin at the line break, and drop a trailing hyphen only when the same word continues the next line without one.
- Whitespace inside a run is literal. Two spaces in the source stay two spaces; do not normalise unless the user asked for clean prose.
Limits worth stating in the report:
- A page whose text is drawn as vector outlines or inside an image has no text layer. Report the page number and the class.
- Character encoding can be wrong even when extraction succeeds: a PDF with a broken `/ToUnicode` map returns plausible-looking garbage. Detect it by a high ratio of characters outside the expected script for the declared language.
## 3. Table reconstruction
There is no table object to read. A table is a set of rules (lines) plus text placed inside the cells, and recovering it is inference.
1. Prefer the drawn rules. `pageLines` gives each stroked line; cluster near-equal `y` values into a horizontal rule, near-equal `x` into a vertical rule, and intersect the two sets to get the cell grid.
2. If no rules exist, fall back to text columns: cluster `--runs` by `x` start, and treat a wide gap as a column edge. This works for a simple three-column invoice and fails on a merged header row.
3. Header detection: the first row whose cells are shorter than the body rows and whose font weight or size differs.
4. Emit markdown with an explicit note when a row's cell count differs from the header's, because that is the signature of a merged cell and the markdown table cannot express it.
State the method used and its confidence. A reconstructed grid with guessed boundaries is a hypothesis; presenting it as exact is a lie the user will discover when the numbers do not add up.
## 4. Images
```
engine.js images <file> --out-dir <dir> [--min-size 64]
```
- Each image is extracted at its stored resolution, not the display resolution. A 300 DPI scan referenced at 72 DPI still extracts at 300.
- `--min-size` filters out the 1×1 spacer images and bullet bitmaps that many generators emit. Below the threshold is decoration, not content.
- An image drawn with a mask (soft edge, transparency) extracts as the base image; the mask is a separate object and is not applied. If visual fidelity matters, render the page instead.
- A page that is one full-bleed image is a scan even when it has a small text layer from a previous OCR pass.
## 5. Metadata and structure
```
engine.js info <file>
```
Returns page count, page boxes, rotation per page, `documentAttributes` (title, author, subject, keywords, creator, producer, dates), form-field count, outline presence, and the byte-scan flags. Use it before extraction to decide the plan, and after generation to confirm what was written.
Form field values are read through `listAnnotations` and written through `setFieldValue`. A field with no appearance stream still holds a value; filling it without regenerating the appearance produces a value the reader shows but the printed page does not.
## Sources
> Checked 2026-11-13.
| Claim | Source |
|---|---|
| PDF content stream text operators and their order | <https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf> (ISO 32000-1 §9.4) |
| `/ToUnicode` map and why broken mapping yields wrong characters | <https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf> (§9.10.3) |
| Table recovery by rule intersection | <https://github.com/jsvine/pdfplumber> (approach only; the implementation here is independent) |
| Image XObject resolution versus display size | <https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf> (§8.9.5) |
### Evidence grade
`LOCAL` for the extraction behaviour and limits, verified by running the engine on generated and real-world documents on this machine. `SPEC` for the format-level claims.Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |