SuperAPI AI Directory

pdfcraft-fill-pdf-forms

Office & productivity

View repository

Updated 11-04 23:01

About this skill

PDF form filling

Before executing the specific method, read Craft scenario commands and parameters, and execute according to the object selection, session, input replacement, and result checking within it.

Task starting point

First read the materials, confirm the delivery purpose, target size or duration, modification scope, and required format. Details that can be determined from the task and materials should directly adopt reasonable defaults; only ask about missing conditions that would change the result.

When a visible editor is needed, hand it over to the pdfcraft-editor skill. Standalone installation:npx skills add full-aigc-skills/pdfcraft-skills --skill pdfcraft-editor. The currently added skill is a local candidate; before release, use the local companion plugin, and do not treat this installation command as proof of release.

Execution steps

  1. Read field names, types, and optional values, and map the data provided by the user.
  2. For missing information, leave it blank or pending confirmation; do not guess and fill it in.
  3. After filling in, check multiline text, fonts, and checkbox states.
  4. Preserve editable fields or output a flattened copy as required.

Field values and display appearance must be accepted separately. The current official 0.8.0 has a reproduced limitation where the appearance displays as ???? when filling Chinese in Helvetica forms; successful storage must not be treated as completed Chinese filling.

Tool implementation

The upstream tool name belongs to PdfCraft. doc_open/doc_create return a doc handle; subsequent doc_info, doc_save, and page_render use the same doc. PDF page numbers start from 1, and parameters are subject to the actual schema.

First read the actual tool schema, then fill in parameters; use the returned values for object or document IDs. Queried commands must be available in the current backend. Before saving, choose a new output path and preserve the input. If the required algorithm, format, or command does not exist, explain the gap; do not pass off a similar name as the real thing.

Result checking

  • Compare name, date, and amount item by item against the input.
  • Flattening is not the same as a digital signature.
  • Reopen the file to confirm that field values and visual display are consistent.

Check the actual content against the user's goal, not just the process exit code. For local edits, inspect local details; for layout tasks, inspect the full page; for time-based media, inspect the start, end, and key segments. For abnormal results, first check the current project to avoid repeatedly performing irreversible operations.

Delivery

Return the editable project, actual derived files, and a brief explanation: what modifications were made, which steps were not executed due to current capabilities, and what requires user judgment. List only files that actually exist and have been checked. If the user subsequently reworks it, read this source project and make local modifications, preserving the content that has already been accepted.

Skill store scenario experience

When encountering a case where fields are discovered first and then filled in, readstore workflow adaptation, and use the corresponding Craft method and actual result checking. Upstream skills are not used as runtime dependencies.

Generate a filling request from real fields

This skill includes scripts/form_request.py, and no other skills need to be installed. Save the raw JSON of the current session form_fields as fields.json, and write the field values explicitly provided by the user into values.json, for example {"customer.name":"张三","consent":false}; field names must exactly match those returned this time, and example names cannot be directly applied.

python3 <本技能目录>/scripts/form_request.py --fields fields.json --values values.json --doc 7 --output request.json

7must be replaced with the ID actually returned by doc_open this time. The tool only generates for the same session form_fill Before executing, verify that the document identity and field snapshot are still valid; do not operate on the PDF, do not open a new CLI process, and do not confirm which file the snapshot belongs to. Text and checkboxes are supported; fields that do not exist, have duplicate names, are read-only, or have unknown writability are rejected; signature, button, and other field types must be handled separately according to the actual native schema. Preserve text verbatim; do not clean it up or convert it to pinyin on your own. Validate only the fields explicitly filled in this instance, and do not claim that the entire form has been completely filled in.

After executing the returned tool and arguments , check warnings; save to a new path, then reopen to compare field values and render the affected pages. Correct storage of Chinese that appears as question marks is still incomplete, and passing this auxiliary tool's validation cannot replace page acceptance. Planned output uses exclusive creation and does not overwrite existing files.