Loading...
Loading...
Create and manipulate PDF files programmatically. Use when the user needs to generate PDFs, fill PDF forms, extract PDF content, add watermarks/overlays, or merge documents. Supports both template-based generation (form filling, overlays) and from-scratch creation. Keywords: PDF, document, form, fillable, merge, watermark, extract, text, report.
npx skill4agent add jwynia/agent-skills pdf-generatordeno run --allow-read scripts/analyze-template.ts form-template.pdf > 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.pdfwatermark-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. 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{
"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
}
]
}{
"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 |
|---|---|---|
| Extract text, metadata, form fields from PDF | |
| Fill forms, add overlays, merge PDFs | |
| Create PDF from JSON specification | |
| Type | Description | Key Options |
|---|---|---|
| Text content | |
| PNG/JPEG images | |
| Filled/outlined rectangles | |
| Straight lines | |
| Filled/outlined circles | |
| Basic table layout | |
HelveticaHelveticaBoldHelveticaObliqueTimesRomanTimesBoldCourierCourierBoldA4LetterLegal[width, height]analyze-template.tsanalyze-template.tsprependPdfsappendPdfspages[1, 3, 5]