/lathe:pdf-formsfrom lathe
Make a PDF with real fillable fields (text boxes and checkboxes that a reader can tick or type in) from a page layout, for planners, trackers, checklists and order forms. Use when the user needs a PDF that people fill in on screen, not a static printable. Lathe's pdf tools read and split fields but do not create them.
Ships in lathe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A fillable PDF needs two things: a page that looks right, and a form layer on top of it. Browsers print the page, but a browser print has no form fields. A PDF library can add form fields, but it cannot lay out a page. So the work is two steps: render the page, record where each field sits, then add the fields at those spots.
data-field="<name>" attribute and a data-type of text or checkbox. Use a fixed page size: US Letter is 8.5 x 11 inches, which is 816 x 1056 CSS pixels at 96 pixels per inch.pip install playwright, then playwright install chromium). Call page.pdf() to write the visual layer, and call page.evaluate() to read each [data-field] element's getBoundingClientRect(). Save the rectangles to a JSON file. Take the rectangles from the live page. Do not compute them from the CSS.y_bottom = page_height_pt - css_bottom * 0.75, and y_top = page_height_pt - css_top * 0.75.from pypdf import PdfReader, PdfWriter
from pypdf.generic import (ArrayObject, BooleanObject, DictionaryObject, FloatObject, NameObject,
NumberObject, TextStringObject)
def add_field(writer, page, name, kind, rect):
"""kind is 'text' or 'checkbox'. rect is [x1, y1, x2, y2] in PDF points, origin bottom-left."""
annot = DictionaryObject({
NameObject("/Type"): NameObject("/Annot"),
NameObject("/Subtype"): NameObject("/Widget"),
NameObject("/Rect"): ArrayObject([FloatObject(v) for v in rect]),
NameObject("/T"): TextStringObject(name),
NameObject("/F"): NumberObject(4),
NameObject("/P"): page.indirect_reference,
})
if kind == "text":
annot[NameObject("/FT")] = NameObject("/Tx")
annot[NameObject("/V")] = TextStringObject("")
else:
annot[NameObject("/FT")] = NameObject("/Btn")
annot[NameObject("/V")] = NameObject("/Off")
annot[NameObject("/AS")] = NameObject("/Off")
ref = writer._add_object(annot)
if "/Annots" not in page:
page[NameObject("/Annots")] = ArrayObject()
page["/Annots"].append(ref)
return ref
def build_form(layout_pdf, fields_json, out_pdf):
"""layout_pdf: the rendered page. fields_json: [{"name", "type", "rect"}, ...] in PDF points."""
import json
with open(fields_json) as fh:
fields = json.load(fh)
reader = PdfReader(layout_pdf)
writer = PdfWriter(clone_from=reader)
page = writer.pages[0]
refs = ArrayObject()
for f in fields:
refs.append(add_field(writer, page, f["name"], f["type"], f["rect"]))
writer._root_object[NameObject("/AcroForm")] = DictionaryObject({
NameObject("/Fields"): refs,
NameObject("/NeedAppearances"): BooleanObject(True),
})
writer.write(out_pdf)
Run build_form on the rendered page and the JSON from step 2 after converting the coordinates. It handles one page. For a multi-page form, pass each page to add_field with its own list.
Check the structure, then look at a rendered page:
from pypdf import PdfReader
fields = PdfReader("form.pdf").get_fields() or {}
assert fields, "no fillable fields: the file was flattened to plain ink"
kinds = {name: f.get("/FT") for name, f in fields.items()}
print(len(fields), "fields", kinds)
/Tx is a text field and /Btn is a checkbox. Assert each field's type against the list you built, and assert the count. Then render one page to PNG at 150 DPI and open it. A structural check cannot show a wrong font or a field in the wrong place.
checkbox type in the JSON, not a name that suggests one. A field named *_checkbox that holds /Tx looks like a box and types like a text field.file:// URL that does not exist fails silently. Check that each @font-face file is on disk, and check the rendered title in a PDF viewer.What SKILL.md sets; muted values are Claude Code's defaults
4 skills in this plugin
/getting-startedSet up and check the Lathe MCP bundle (images, PDF, audio and video, OCR, batch runs, metadata removal). Use when the user installs Lathe, asks what Lathe can do, gets a "lathe." error from a tool, sees a "missing" or "approval_unavailable" result, or wants to turn a module on or off./pdfConvert a Markdown file to a PDF with Chrome or Chromium in headless mode. Use when the user asks to turn a Markdown note, report or spec into a PDF and Chrome or Chromium is installed. Lathe's own PDF tools do not render Markdown./web-image-prepPrepare a folder of photos or screenshots for a website or post: remove GPS and camera metadata, resize, and optimize each file in one batch run. Use when the user wants to shrink, convert or clean photos before uploading them, or asks to remove location data from a picture.Other plugins' skills for the same job
lathe@seayniclabs is listed by seayniclabs/plugins — review the source before installing
npx claudepluginhub seayniclabs/plugins --plugin lathe