agentleFS
oidsdevoidsdev/honeypot/skills/pdf-text/SKILL.md

pdf-text

Skill0 starsChanged 21 days agoMITView on GitHub

Extract selectable text from a PDF with pdftotext. Use when an agent needs the text layer of a PDF file.

  • Installs packages

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If that fails, install Poppler utils:

    line 20
  2. Very specific:

    Write the text to stdout. The second argument - means stdout.

    line 34
  3. Distinctive:

    Check the output. A text layer comes back as words.

    line 46

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “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 text

Pull the text layer out of a PDF with Poppler's pdftotext. The result is plain text on stdout or in a file you name.

When to use

The user hands you a PDF and wants the words in it: a page range, a whole document, or text that keeps the visual columns. This skill stops when the file has no text layer.

Install

pdftotext -v

If that fails, install Poppler utils:

# Debian / Ubuntu
sudo apt-get install poppler-utils

# macOS
brew install poppler

pdftotext -h lists the flags for the build you have.

Commands

Write the text to stdout. The second argument - means stdout. -layout keeps the columns where they were on the page. -nopgbrk leaves out the form-feed between pages.

pdftotext -layout -nopgbrk report.pdf -

Limit the range. Pages are numbered from 1.

pdftotext -f 1 -l 3 -layout report.pdf pages.txt

Check the output. A text layer comes back as words. An empty file means the pages are images.

wc -c pages.txt

Gotchas

  • pdftotext reads the embedded text layer. A scanned page with no text layer produces an empty result. Optical character recognition is a different tool.
  • -layout is the right default for multi-column pages. -raw follows the content stream and is no longer the recommended mode.
  • An encrypted file makes pdftotext exit with an error. Stop and ask the user. Do not guess passwords.
  • Page numbers start at 1. -f and -l are inclusive.

Also on Honeypot — a free, open index of skills for AI agents: https://honeypot-e6c.pages.dev Image: Indexed on Honeypot

Download now (ZIP)

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.