agentleFS
Lemon5211Lemon5211/pdf-to-word/SKILL.md

pdf-to-word

Skill0 starsChanged 32 days agoMITView on GitHub

Convert a designed PDF into an editable Word .docx that keeps the original layout, colours, artwork and pagination. Use when a PDF (resume, one-pager, report, flyer, form) has to become a Word document. Not for editing a PDF in place, and not for scanned PDFs without a text layer (those need OCR first).

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. diegoperea20/pdftoword★ 1same name
    2. tanod-labs/tanod-mcp★ 1same name

    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.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never rasterise text to imitate the design, and never summarise or "improve" the wording: the user asked for a conversion.

    line 18
  2. Very specific:

    Read work/report.txt. It lists, per page: page size, images and links with coordinates, vector shapes with fill colours (ribbons, rules, …

    line 34
  3. Very specific:

    Do not deliver on an unrendered VERDICT: FAIL.

    line 70
  4. Very specific:

    Use inspect_pdf.py --ascii to confirm the visual structure in text form (bands, bars, photo placement) when images cannot be viewed …

    line 76
  5. Very specific:

    Put the .docx next to the source file unless the user asked for a different location, and state plainly:

    line 81

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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 to Word

Produce a .docx that a person can edit in Word or WPS and that still looks like the source PDF: same page count and page breaks, same text, same colours and artwork in the same places, with every sentence as real editable text.

Boundaries

  • A text layer is required. inspect_pdf.py reports when a page has none - that is a scan, so say OCR is needed instead of quietly shipping pictures of text.
  • Never rasterise text to imitate the design, and never summarise or "improve" the wording: the user asked for a conversion.
  • Content the source got wrong (a dangling 、, a truncated sentence, an odd quote mark) stays as it is, and is mentioned in the hand-off.

Workflow

Work in a scratch folder per document; keep the build script there so the conversion can be re-run after an edit.

1. Inspect the source

python scripts/inspect_pdf.py INPUT.pdf --out work --json --render

Read work/report.txt. It lists, per page: page size, images and links with coordinates, vector shapes with fill colours (ribbons, rules, bands, margin bars), and text rows with per-run bold/size/font/colour/x-range.

Decide before writing any code:

  • what is prose (becomes flowing paragraphs) versus what is artwork (photo, logo, icon badge - gets cropped and re-inserted);
  • the page geometry: margins, the text box, the line rhythm;
  • whether the source's own label columns, bands or tables need real Word constructs. references/layout-fidelity.md maps each PDF construct to the Word equivalent with the measured numbers.

2. Rebuild in Word

Copy scripts/build_template.py into the scratch folder, replace its CONTENT block with the inspected text, and adjust the geometry constants. It already demonstrates the whole recipe (header block, accent band, section bars, form grid, floating picture, bullets) on top of scripts/ooxml.py, which holds the OOXML primitives python-docx lacks.

Crop any artwork with scripts/crop_pdf_image.py and place it with the PDF's own image bbox so nothing has to be eyeballed:

python scripts/crop_pdf_image.py INPUT.pdf --page 1 --auto --out-dir work
python scripts/crop_pdf_image.py INPUT.pdf --page 1 --bbox 400,30,500,60 --out work/badges.png

3. Verify by rendering

python scripts/render_docx.py work/out.docx
python scripts/verify_conversion.py --source INPUT.pdf --docx work/out.docx --rendered work/out.pdf

Do not deliver on an unrendered VERDICT: FAIL. The expected result is identical text, the same page count with the same section starting each page, and artwork within a few points of the source. Iterate on the cause of any drift - references/rendering-and-verification.md explains how to read the report and what to change.

Use inspect_pdf.py --ascii to confirm the visual structure in text form (bands, bars, photo placement) when images cannot be viewed directly.

4. Hand off

Put the .docx next to the source file unless the user asked for a different location, and state plainly:

  • what is faithful (text, page breaks, artwork positions, links);
  • what was approximated (slanted ribbons straightened, decorative artwork re-inserted as a picture, sub-point artefacts dropped);
  • anything in the source that looks like an authoring mistake.

Reference material

  • references/layout-fidelity.md - PDF construct → Word construct mapping, the geometry conversions, a worked two-page resume example, and the OOXML pitfalls that cost real debugging time (run shading, merged tables, floating pictures inside cells, East Asian fonts, hanging punctuation).
  • references/rendering-and-verification.md - runtimes, how to drive Word headlessly when its COM type library is broken, what the verification report means, and how to iterate on drift.

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.