agentleFS
ai-ecoverseai-ecoverse/skills/skills/pdf/SKILL.md

pdf

Skill1 starsChanged 30 days agoApache-2.0View on GitHub

Read, merge, split, rotate and rasterise PDF files with SLICC's built-in pdftk and pdftoppm, plus `pdf-text` for validated text extraction. Text extraction succeeds on simple fonts and on any PDF carrying a /ToUnicode CMap; for subset CID fonts without one it refuses to return glyph-index mojibake and escalates to poppler on an ssh follower, and it reports a scanned/image-only PDF as having no text layer instead of guessing. No Python required. Use when the user asks to work with PDFs or .pdf files, extract or read text from a PDF, merge, split, rotate or burst documents, check page count or metadata, or convert a PDF page to an image. Not OCR of scanned pages, not PDF form filling, and not PPTX conversion (use the pptx2pdf skill).

  • Installs packages

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 181 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use pdf-text, not pdftk directly.

    line 41
  2. Distinctive:

    If nothing trustworthy comes out it rasterises for visual inspection, labels the images as *not text*, and exits 3.

    line 48
  3. Very specific:

    Write outputs to /shared/ or /mnt/.

    line 119

“Common” is measured: kept by at least 6 in 10 of the 181 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

PDF Skill

Work with PDFs using SLICC's built-in pdftk (backed by @cantoo/pdf-lib + unpdf), pdftoppm/pdftocairo, and convert (magick-wasm).

pdftotext, mutool and qpdf do not exist in SLICC, and there is no OCR engine.

Quick start

pdf-text /mnt/invoice.pdf [--layout]   # extract text, validated, reports its tier
pdftk /mnt/file.pdf dump_data          # metadata: NumberOfPages, Info keys
pdftk A=/mnt/a.pdf B=/mnt/b.pdf cat A B output /shared/merged.pdf
pdftoppm -r 150 -png /mnt/file.pdf /shared/page   # -> /shared/page-1.png

Extract text

Use pdf-text, not pdftk directly. It tries three tiers, checks each result for garbage, and always reports which tier produced the output:

  1. pdftk dump_data_utf8 — SLICC's unpdf extractor; honours /ToUnicode
  2. own zlib inflation of page content streams + /ToUnicode CMap decoding
  3. offload to an ssh exec follower running poppler pdftotext -layout

If nothing trustworthy comes out it rasterises for visual inspection, labels the images as not text, and exits 3.

pdf-text file.pdf [--layout] [--tier1-only] [--no-ssh] [--json] [--pages N-M]

--layout preserves columns (tier 2 only) · --tier1-only stays local, no ssh or raster · --no-ssh skips the offload · --json gives provenance and per-tier rejection reasons · --pages N-M restricts first (1-based, 3-end works).

Exit codes: 0 text extracted · 3 nothing trustworthy · 1 usage/IO error.

Why not pdftk dump_data_utf8 on its own?

It exits 0 and prints plausible output even when it has failed. Given a subset CID font with no /ToUnicode CMap it emits the raw glyph indices:

$ pdftk cid-nounicode.pdf dump_data_utf8
$QH7H
$ echo $?
0

Those bytes are glyph selectors, not characters. It has two silent failure modes — measured, it exits 0 and emits no metadata in all three cases:

Page contentstdoutmeans
text layer, simple fontcorrect textfine
CID text, no /ToUnicodemojibakeglyphs unmappable → escalate to poppler
raster image only (a scan)emptyno text layer → nothing can decode it

pdf-text guards every tier (poppler's output included) and tells the two apart: unusable bytes get the CID diagnosis, empty output everywhere is reported as a missing text layer.

Merge, split, rotate, rasterise

pdftk A=/mnt/a.pdf B=/mnt/b.pdf cat A B output /shared/merged.pdf
pdftk /shared/merged.pdf dump_data | head -1        # verify the page count
pdftk /mnt/file.pdf cat 4-end output /shared/from4.pdf
pdftk /mnt/file.pdf burst output /shared/page_%02d.pdf     # zero-padded, use %02d
pdftk /mnt/file.pdf rotate 1-end right output /shared/rotated.pdf
pdftoppm -r 150 -png /mnt/file.pdf /shared/page
open --view /shared/page-1.png --size high

Positional syntax — inputs come before the operation; multi-file ops need handle labels (A=, B=). Ranges are 1-based, end is the last page, burst zero-pads. Rotations: right 90° CW, left 90° CCW, down 180°. Confirm NumberOfPages from dump_data before using a range.

Troubleshooting

  • Text came out as symbols, boxes or consonant soup — subset CID font with no /ToUnicode. pdf-text already refuses it; attach an ssh follower with poppler (brew install poppler) and re-run without --no-ssh.
  • pdf-text says NO TEXT LAYER — the page is a raster (a scan). No extractor can help; SLICC has no OCR engine. Read the rasterised page images it points at, or OCR them elsewhere.
  • pdf-text exits 3 — believe it and read the per-tier reasons; --json gives them machine-readably. It found nothing it could vouch for.
  • convert cannot write PDF — it only rasterises PDF input, and convert x.png x.pdf silently emits a PNG named .pdf. Use pdftoppm for PDF→image. convert also needs magick-wasm (ipk install -g @imagemagick/magick-wasm) and has no text: coder.
  • create-pdf currently fails (Top-level await … not supported with the "cjs" output format) — await import(…pdf-lib) forces the ESM→CJS transpile path.
  • Write outputs to /shared/ or /mnt/; /tmp/ may not exist in a sandbox.

Reference

  • references/text-extraction.md — the escalation ladder, why CID fonts defeat local extraction, the garbage guard's thresholds and regression results, the chunked-base64 ssh transfer recipe, .jsh runtime gotchas, and reproducible test fixtures.
  • tests/run-tests.sh — 58 assertions; runs without installing the skill.
  • Form filling and OCR are not available in SLICC.
  • For PPTX → PDF with font embedding and layout fidelity, use the pptx2pdf skill.

Download now (ZIP)

  • Other versions192 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 192

    1. NousResearch/hermes-agent★ 259ksame name
    2. anthropics/skills★ 186ksame name
    3. shareAI-lab/learn-claude-code★ 80ksame name
    4. shareAI-lab/analysis_claude_code★ 78ksame name
    5. openai/skills★ 27ksame name
    6. spinabot/brigade★ 11ksame name
    7. netease-youdao/LobsterAI★ 6.2ksame name
    8. OpenBMB/PilotDeck★ 4.5ksame name
    9. nextlevelbuilder/goclaw★ 3.7ksame name
    10. awslabs/amazon-bedrock-agentcore-samples★ 3.5ksame name

    182 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects with it also use Video Generation, VLM and 10 more.

    Other files people use alongside this one.

    Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
    • huang-x-hSkill

      Video Generation

      Implement AI-powered video generation capabilities using the z-ai-web-dev-sdk. Use this skill when the user needs to generate videos from text prompts or images, create video content programmatically, or build applications that produce video outputs. Supports asynchronous task management with status polling and result retrieval.

      Also in 6 projects that use this

    • huang-x-hSkill

      VLM

      Implement vision-based AI chat capabilities using the z-ai-web-dev-sdk. Use this skill when the user needs to analyze images, describe visual content, or create applications that combine image understanding with conversational AI. Supports image URLs and base64 encoded images for multimodal interactions.

      Also in 6 projects that use this

    • dav-niu474Skill

      gift-evaluator

      The PRIMARY tool for Spring Festival gift analysis and social interaction generation. Use this skill when users upload photos of gifts (alcohol, tea, supplements, etc.) to inquire about their value, authenticity, or how to respond socially. Integrates visual perception, market valuation, and HTML card generation.

      Also in 5 projects that use this

    • dav-niu474Skill

      Podcast Generate

      Generate podcast episodes from user-provided content or by searching the web for specified topics. If user uploads a text file/article, creates a dual-host dialogue podcast (or single-host upon request). If no content is provided, searches the web for information about the user-specified topic and generates a podcast. Duration scales with content size (3-20 minutes, ~240 chars/min). Uses z-ai-web-dev-sdk for LLM script generation and TTS audio synthesis. Outputs both a podcast script (Markdown) and a complete audio file (WAV).

      Also in 5 projects that use this

    • OpenAISkill

      migrate-to-codex

      Migrate supported instruction files, skills, agents, and MCP config into Codex project and global files.

      Also in 6 projects that use this

    • SeifBenayedSkill

      file-reading

      Use this skill when a file has been uploaded but its content is NOT in your context — only its path at /mnt/user-data/uploads/ is listed in an uploaded_files block. This skill is a router: it tells you which tool to use for each file type (pdf, docx, xlsx, csv, json, images, archives, ebooks) so you read the right amount the right way instead of blindly running cat on a binary. Triggers: any mention of /mnt/user-data/uploads/, an uploaded_files section, a file_path tag, or a user asking about an uploaded file you have not yet read. Do NOT use this skill if the file content is already visible in your context inside a documents block — you already have it.

      Also in 5 projects that use this

    • +1 more from huang-x-h
    • +2 more from dav-niu474
  • In this repository71 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.