pdf-generator by jwynia/agent-skills
npx skills add https://github.com/jwynia/agent-skills --skill pdf-generator在以下情况下使用此技能:
在以下情况下不要使用此技能:
从现有 PDF 中提取表单字段和结构:
deno run --allow-read scripts/analyze-template.ts form-template.pdf > inventory.json
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
输出 (inventory.json):
{
"filename": "form-template.pdf",
"pageCount": 2,
"title": "Application Form",
"author": "Company Inc",
"pages": [
{ "pageNumber": 1, "width": 612, "height": 792, "text": "..." }
],
"formFields": [
{ "name": "FullName", "type": "text", "value": "" },
{ "name": "Email", "type": "text", "value": "" },
{ "name": "AgreeToTerms", "type": "checkbox", "value": false }
],
"placeholders": [
{ "tag": "{{DATE}}", "location": "page 1", "pageNumber": 1 }
],
"hasFormFields": true
}
创建 form-data.json:
{
"formFields": [
{ "name": "FullName", "value": "John Smith" },
{ "name": "Email", "value": "john@example.com" },
{ "name": "AgreeToTerms", "value": true }
],
"flattenForm": true
}
deno run --allow-read --allow-write scripts/generate-from-template.ts \
form-template.pdf form-data.json filled-form.pdf
创建 watermark-spec.json:
{
"overlays": [
{
"type": "text",
"page": 1,
"x": 200,
"y": 400,
"text": "CONFIDENTIAL",
"fontSize": 48,
"color": { "r": 1, "g": 0, "b": 0 },
"rotate": 45
},
{
"type": "image",
"page": 1,
"x": 450,
"y": 700,
"path": "logo.png",
"width": 100,
"height": 50
}
]
}
创建 merge-spec.json:
{
"prependPdfs": [
{ "path": "cover-page.pdf" }
],
"appendPdfs": [
{ "path": "appendix-a.pdf", "pages": [1, 2, 3] },
{ "path": "appendix-b.pdf" }
],
"excludePages": [5, 6]
}
创建 spec.json:
{
"title": "Quarterly Report",
"author": "Finance Team",
"pages": [
{
"size": "A4",
"elements": [
{
"type": "text",
"x": 50,
"y": 750,
"text": "Q4 2024 Financial Report",
"fontSize": 28,
"font": "HelveticaBold",
"color": { "r": 0, "g": 0, "b": 0.5 }
},
{
"type": "line",
"startX": 50,
"startY": 740,
"endX": 550,
"endY": 740,
"thickness": 2
},
{
"type": "text",
"x": 50,
"y": 700,
"text": "Executive Summary",
"fontSize": 18,
"font": "HelveticaBold"
},
{
"type": "text",
"x": 50,
"y": 670,
"text": "This quarter showed strong growth across all divisions...",
"fontSize": 12,
"maxWidth": 500,
"lineHeight": 16
}
]
}
]
}
deno run --allow-read --allow-write scripts/generate-scratch.ts spec.json output.pdf
场景:自动填写工作申请表。
# 1. 分析表单以查找字段名称
deno run --allow-read scripts/analyze-template.ts application.pdf --pretty
# 2. 使用申请人信息创建 form-data.json
# 3. 生成填写好的表单
deno run --allow-read --allow-write scripts/generate-from-template.ts \
application.pdf form-data.json john-smith-application.pdf
场景:向文档添加"已批准"印章。
stamp-spec.json:
{
"overlays": [
{
"type": "rectangle",
"page": 1,
"x": 400,
"y": 700,
"width": 150,
"height": 50,
"color": { "r": 0.9, "g": 1, "b": 0.9 }
},
{
"type": "text",
"page": 1,
"x": 410,
"y": 720,
"text": "APPROVED",
"fontSize": 20,
"font": "HelveticaBold",
"color": { "r": 0, "g": 0.5, "b": 0 }
},
{
"type": "text",
"page": 1,
"x": 410,
"y": 705,
"text": "2024-12-15",
"fontSize": 10
}
]
}
场景:生成包含数据表格的简单报告。
report-spec.json:
{
"title": "Sales Report",
"pages": [{
"size": "Letter",
"elements": [
{
"type": "text",
"x": 72,
"y": 720,
"text": "Monthly Sales Report",
"fontSize": 24,
"font": "HelveticaBold"
},
{
"type": "table",
"x": 72,
"y": 680,
"rows": [
["Product", "Units", "Revenue"],
["Widget A", "150", "$15,000"],
["Widget B", "75", "$11,250"],
["Widget C", "200", "$8,000"]
],
"columnWidths": [150, 80, 100],
"rowHeight": 25,
"headerBackground": { "r": 0.9, "g": 0.9, "b": 0.9 }
}
]
}]
}
| 脚本 | 用途 | 所需权限 |
|---|---|---|
analyze-template.ts | 从 PDF 提取文本、元数据、表单字段 | --allow-read |
generate-from-template.ts | 填充表单、添加覆盖层、合并 PDF | --allow-read --allow-write |
generate-scratch.ts | 根据 JSON 规范创建 PDF | --allow-read --allow-write |
| 类型 | 描述 | 关键选项 |
|---|---|---|
text | 文本内容 | x, y, text, fontSize, font, color, rotate |
image | PNG/JPEG 图像 | x, y, path, width, height, opacity |
rectangle | 填充/描边矩形 | x, y, width, height, color, borderColor |
line | 直线 | startX, startY, endX, endY, thickness |
circle | 填充/描边圆形 | x, y, radius, color, borderColor |
table | 基本表格布局 | x, y, rows, columnWidths, rowHeight |
Helvetica (默认)HelveticaBoldHelveticaObliqueTimesRomanTimesBoldCourierCourierBoldA4 (595.28 x 841.89 点)Letter (612 x 792 点)Legal (612 x 1008 点)[width, height](以点为单位)症状:错误提示字段名不存在。
解决方案:
analyze-template.ts 以获取确切的字段名称症状:文本出现在错误的位置。
解决方案:
analyze-template.ts 查看页面尺寸症状:图像覆盖层不可见。
解决方案:
症状:页面以意外顺序出现。
解决方案:
prependPdfs 在模板之前添加页面appendPdfs 在模板之后添加页面pages 数组选择特定页面:[1, 3, 5]每周安装次数
303
代码仓库
GitHub 星标数
37
首次出现
2026 年 1 月 20 日
安全审计
安装于
opencode279
gemini-cli272
codex271
github-copilot262
cursor260
amp244
Use this skill when:
Do NOT use this skill when:
Template Mode : Modify existing PDF templates
Scratch Mode : Create PDFs from nothing using JSON specifications
Extract form fields and structure from an existing PDF:
deno run --allow-read scripts/analyze-template.ts form-template.pdf > inventory.json
Output (inventory.json):
{
"filename": "form-template.pdf",
"pageCount": 2,
"title": "Application Form",
"author": "Company Inc",
"pages": [
{ "pageNumber": 1, "width": 612, "height": 792, "text": "..." }
],
"formFields": [
{ "name": "FullName", "type": "text", "value": "" },
{ "name": "Email", "type": "text", "value": "" },
{ "name": "AgreeToTerms", "type": "checkbox", "value": false }
],
"placeholders": [
{ "tag": "{{DATE}}", "location": "page 1", "pageNumber": 1 }
],
"hasFormFields": true
}
Create form-data.json:
{
"formFields": [
{ "name": "FullName", "value": "John Smith" },
{ "name": "Email", "value": "john@example.com" },
{ "name": "AgreeToTerms", "value": true }
],
"flattenForm": true
}
deno run --allow-read --allow-write scripts/generate-from-template.ts \
form-template.pdf form-data.json filled-form.pdf
Create watermark-spec.json:
{
"overlays": [
{
"type": "text",
"page": 1,
"x": 200,
"y": 400,
"text": "CONFIDENTIAL",
"fontSize": 48,
"color": { "r": 1, "g": 0, "b": 0 },
"rotate": 45
},
{
"type": "image",
"page": 1,
"x": 450,
"y": 700,
"path": "logo.png",
"width": 100,
"height": 50
}
]
}
Create merge-spec.json:
{
"prependPdfs": [
{ "path": "cover-page.pdf" }
],
"appendPdfs": [
{ "path": "appendix-a.pdf", "pages": [1, 2, 3] },
{ "path": "appendix-b.pdf" }
],
"excludePages": [5, 6]
}
Create spec.json:
{
"title": "Quarterly Report",
"author": "Finance Team",
"pages": [
{
"size": "A4",
"elements": [
{
"type": "text",
"x": 50,
"y": 750,
"text": "Q4 2024 Financial Report",
"fontSize": 28,
"font": "HelveticaBold",
"color": { "r": 0, "g": 0, "b": 0.5 }
},
{
"type": "line",
"startX": 50,
"startY": 740,
"endX": 550,
"endY": 740,
"thickness": 2
},
{
"type": "text",
"x": 50,
"y": 700,
"text": "Executive Summary",
"fontSize": 18,
"font": "HelveticaBold"
},
{
"type": "text",
"x": 50,
"y": 670,
"text": "This quarter showed strong growth across all divisions...",
"fontSize": 12,
"maxWidth": 500,
"lineHeight": 16
}
]
}
]
}
deno run --allow-read --allow-write scripts/generate-scratch.ts spec.json output.pdf
Scenario : Automatically fill a job application form.
# 1. Analyze form to find field names
deno run --allow-read scripts/analyze-template.ts application.pdf --pretty
# 2. Create form-data.json with applicant info
# 3. Generate filled form
deno run --allow-read --allow-write scripts/generate-from-template.ts \
application.pdf form-data.json john-smith-application.pdf
Scenario : Add an "APPROVED" stamp to a document.
stamp-spec.json :
{
"overlays": [
{
"type": "rectangle",
"page": 1,
"x": 400,
"y": 700,
"width": 150,
"height": 50,
"color": { "r": 0.9, "g": 1, "b": 0.9 }
},
{
"type": "text",
"page": 1,
"x": 410,
"y": 720,
"text": "APPROVED",
"fontSize": 20,
"font": "HelveticaBold",
"color": { "r": 0, "g": 0.5, "b": 0 }
},
{
"type": "text",
"page": 1,
"x": 410,
"y": 705,
"text": "2024-12-15",
"fontSize": 10
}
]
}
Scenario : Generate a simple report with a data table.
report-spec.json :
{
"title": "Sales Report",
"pages": [{
"size": "Letter",
"elements": [
{
"type": "text",
"x": 72,
"y": 720,
"text": "Monthly Sales Report",
"fontSize": 24,
"font": "HelveticaBold"
},
{
"type": "table",
"x": 72,
"y": 680,
"rows": [
["Product", "Units", "Revenue"],
["Widget A", "150", "$15,000"],
["Widget B", "75", "$11,250"],
["Widget C", "200", "$8,000"]
],
"columnWidths": [150, 80, 100],
"rowHeight": 25,
"headerBackground": { "r": 0.9, "g": 0.9, "b": 0.9 }
}
]
}]
}
| Script | Purpose | Permissions |
|---|---|---|
analyze-template.ts | Extract text, metadata, form fields from PDF | --allow-read |
generate-from-template.ts | Fill forms, add overlays, merge PDFs | --allow-read --allow-write |
generate-scratch.ts | Create PDF from JSON specification | --allow-read --allow-write |
| Type | Description | Key Options |
|---|---|---|
text | Text content | x, y, text, fontSize, font, color, rotate |
image |
Helvetica (default)HelveticaBoldHelveticaObliqueTimesRomanTimesBoldCourierCourierBoldA4 (595.28 x 841.89 points)Letter (612 x 792 points)Legal (612 x 1008 points)[width, height] in pointsSymptoms : Error saying field name doesn't exist.
Solution :
analyze-template.ts to get exact field namesSymptoms : Text appears in wrong location.
Solution :
analyze-template.ts to see page dimensionsSymptoms : Image overlay not visible.
Solution :
Symptoms : Pages appear in unexpected order.
Solution :
prependPdfs add pages before templateappendPdfs add pages after templatepages array to select specific pages: [1, 3, 5]Weekly Installs
303
Repository
GitHub Stars
37
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode279
gemini-cli272
codex271
github-copilot262
cursor260
amp244
GitHub Actions 官方文档查询助手 - 精准解答 CI/CD 工作流问题
22,500 周安装
| PNG/JPEG images |
x, y, path, width, height, opacity |
rectangle | Filled/outlined rectangles | x, y, width, height, color, borderColor |
line | Straight lines | startX, startY, endX, endY, thickness |
circle | Filled/outlined circles | x, y, radius, color, borderColor |
table | Basic table layout | x, y, rows, columnWidths, rowHeight |