-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add sspdf partner-built plugin — PDF generation #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "name": "sspdf", | ||
| "version": "1.0.0", | ||
| "description": "Generate publication-ready PDF documents — financial reports, tear sheets, invoices, and branded deliverables — directly from Claude with deterministic, math-first rendering. No LibreOffice, no browser, no pixel nudging.", | ||
| "author": { | ||
| "name": "Hugo Palma" | ||
| }, | ||
| "repository": "https://github.com/hugopalma17/sspdf", | ||
| "license": "Apache-2.0", | ||
| "keywords": ["pdf", "document-generation", "financial-reports", "invoices", "charts", "tables"] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # sspdf — PDF Generation Plugin | ||
|
|
||
| Generate publication-ready PDF documents directly from Claude — financial reports, tear sheets, invoices, articles, and branded deliverables — with deterministic, math-first rendering. | ||
|
|
||
| ## What This Plugin Does | ||
|
|
||
| This plugin gives Claude the ability to produce PDF documents from natural language descriptions. Instead of generating HTML and converting it, or relying on LibreOffice, sspdf renders PDFs directly via jsPDF with precise mathematical layout. The output is deterministic: same input, same PDF, every time. | ||
|
|
||
| The engine separates content from styling completely. A **source** JSON describes what to render (text, tables, charts, dividers, blocks). A **theme** JS file controls how it looks (fonts, colors, spacing, page geometry). Claude builds both from a description and renders the final PDF. | ||
|
|
||
| ## Skills | ||
|
|
||
| | Skill | What It Does | | ||
| |-------|-------------| | ||
| | `sspdf` | Builds source JSON and renders PDF documents. Knows all operation types (text, tables, charts, rows, bullets, blocks, quotes, dividers) and the complete rendering pipeline. | | ||
| | `sspdf-theme-generator` | Creates custom theme files from brand specs. Knows the full label property schema — page config, text styling, spacing, containers, table formatting, dividers. | | ||
|
|
||
| ## Commands | ||
|
|
||
| | Command | Description | | ||
| |---------|-------------| | ||
| | `/generate-pdf` | Generate a PDF from a natural language description | | ||
| | `/create-theme` | Create a custom theme from brand specifications | | ||
|
|
||
| ## What It Can Render | ||
|
|
||
| - **Text** — wrapped paragraphs, headings, captions with full font/style control | ||
| - **Tables** — column alignment, alternating row shading, borders, header repetition on page breaks | ||
| - **Charts** — bar, line, pie, stacked bar, grouped bar — rendered as embedded images via canvas | ||
| - **Rows** — left/right aligned pairs (ideal for invoice line items, key-value data) | ||
| - **Blocks** — grouped content with background, border, and keep-together pagination | ||
| - **Quotes** — blockquotes with optional attribution | ||
| - **Bullets** — custom markers with wrapped text | ||
| - **Page templates** — repeating headers and footers with `{{page}}` token | ||
| - **Hidden text** — invisible text layer for ATS keyword injection | ||
|
|
||
| Built-in themes: `default`, `editorial`, `newsprint`, `corporate`, `ceremony`, `program`, `financial`. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| npm install h17-sspdf | ||
| ``` | ||
|
|
||
| Requires Node.js and the `canvas` native addon (automatically installed as a dependency). | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ```bash | ||
| # CLI | ||
| npx h17-sspdf -s source.json -t financial -o output/report.pdf | ||
|
|
||
| # Programmatic | ||
| const { renderDocument } = require("h17-sspdf"); | ||
| renderDocument({ source, theme, outputPath: "output/report.pdf" }); | ||
| ``` | ||
|
Comment on lines
+49
to
+56
|
||
|
|
||
| ## Why sspdf | ||
|
|
||
| - **No LibreOffice** — Renders PDFs directly via jsPDF. No headless browsers, no OS-level dependencies beyond Node.js. | ||
| - **Deterministic** — Math-first layout engine. Same input produces identical output on any machine. | ||
| - **Charts and tables out of the box** — Native table operation with page-break header repetition. Chart plugin renders bar, line, pie charts as embedded images. | ||
| - **Content/style separation** — Source JSON never contains colors, fonts, or sizes. The theme controls all visual decisions. Swap themes without touching content. | ||
| - **Pagination built in** — Automatic page breaks, keep-together blocks, orphan prevention, header/footer templates. | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Node.js 18+ | ||
| - npm (for h17-sspdf package installation) | ||
|
|
||
| ## License | ||
|
|
||
| [Apache License 2.0](../../LICENSE) | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,49 @@ | ||||||
| --- | ||||||
| description: Create a custom sspdf theme from brand specs — colors, fonts, and document type | ||||||
| argument-hint: "<brand specs> (e.g. 'navy headers, Helvetica, financial tear sheet')" | ||||||
| --- | ||||||
|
|
||||||
| # Create Theme | ||||||
|
|
||||||
| > This command uses the sspdf engine (`h17-sspdf` npm package). See the **sspdf-theme-generator** skill for the full property reference. | ||||||
|
|
||||||
| Create a custom theme file for the sspdf PDF engine from brand specifications. | ||||||
|
|
||||||
| ## Workflow | ||||||
|
|
||||||
| ### 1. Gather Brand Specs | ||||||
|
|
||||||
| Ask the user for: | ||||||
| - Primary and accent colors | ||||||
| - Font preferences (built-in: helvetica, courier, times — or TTF for custom) | ||||||
| - Document type the theme targets | ||||||
| - Any reference materials or existing brand guidelines | ||||||
|
|
||||||
| ### 2. Read Documentation | ||||||
|
|
||||||
| ```bash | ||||||
| SSPDF_DIR=$(node -e "console.log(require.resolve('h17-sspdf').replace('/index.js',''))") | ||||||
|
||||||
| SSPDF_DIR=$(node -e "console.log(require.resolve('h17-sspdf').replace('/index.js',''))") | |
| SSPDF_DIR=$(node -e "const path = require('path'); console.log(path.dirname(require.resolve('h17-sspdf/package.json')))") |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||
| --- | ||||||
| description: Generate a PDF document from a description — invoices, reports, tear sheets, articles, or any printable deliverable | ||||||
| argument-hint: "<what to generate> (e.g. 'quarterly earnings summary for AAPL', 'invoice for $7,250')" | ||||||
| --- | ||||||
|
|
||||||
| # Generate PDF | ||||||
|
|
||||||
| > This command uses the sspdf engine (`h17-sspdf` npm package) to render PDF documents. No external dependencies beyond Node.js and the canvas native addon. | ||||||
|
|
||||||
| Generate a publication-ready PDF from a natural language description. Builds the source JSON, selects or creates a theme, and renders the output. | ||||||
|
|
||||||
| See the **sspdf** skill for the full operation reference and rendering workflow. | ||||||
|
|
||||||
| ## Workflow | ||||||
|
|
||||||
| ### 1. Determine the Document | ||||||
|
|
||||||
| Ask the user what they need if not already clear from the argument. Identify: | ||||||
| - Document type (report, invoice, tear sheet, article, program, etc.) | ||||||
| - Content to include | ||||||
| - Any brand preferences (colors, fonts) | ||||||
|
|
||||||
| ### 2. Read Documentation | ||||||
|
|
||||||
| ```bash | ||||||
| SSPDF_DIR=$(node -e "console.log(require.resolve('h17-sspdf').replace('/index.js',''))") | ||||||
|
||||||
| SSPDF_DIR=$(node -e "console.log(require.resolve('h17-sspdf').replace('/index.js',''))") | |
| SSPDF_DIR=$(node -e "const path = require('path'); console.log(path.dirname(require.resolve('h17-sspdf/package.json')))") |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,147 @@ | ||||||
| --- | ||||||
| name: sspdf-theme-generator | ||||||
| description: Generate custom sspdf theme files from brand specs — colors, fonts, and document type. Use when asked to create a theme, style a document, or design a PDF layout for sspdf. | ||||||
| --- | ||||||
|
|
||||||
| # sspdf Theme Generator | ||||||
|
|
||||||
| Generate theme files for the sspdf PDF engine. A theme is a JS object that controls every visual decision in a document — page geometry, baseline state, and label styles. Themes produced here work on first render. | ||||||
|
|
||||||
| ## Setup | ||||||
|
|
||||||
| Verify h17-sspdf is installed: | ||||||
|
|
||||||
| ```bash | ||||||
| npx h17-sspdf --help | ||||||
| ``` | ||||||
|
|
||||||
| If this fails, install it: | ||||||
|
|
||||||
| ```bash | ||||||
| npm install h17-sspdf | ||||||
| ``` | ||||||
|
|
||||||
| ## How It Works | ||||||
|
|
||||||
| The sspdf engine takes two inputs: a theme (styling rules) and a source (content). The theme controls page geometry, baseline state, and label styles. The source references labels by name. If a label is missing, the engine throws. | ||||||
|
|
||||||
| Resolve the package location: | ||||||
|
|
||||||
| ```bash | ||||||
| SSPDF_DIR=$(node -e "console.log(require.resolve('h17-sspdf').replace('/index.js',''))") | ||||||
|
||||||
| SSPDF_DIR=$(node -e "console.log(require.resolve('h17-sspdf').replace('/index.js',''))") | |
| SSPDF_DIR=$(node -e "console.log(require('path').dirname(require.resolve('h17-sspdf/package.json')))") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plugin directory is missing a
.mcp.jsonat the root. The repo-level docs describe the standard plugin layout as including.mcp.jsonalongside.claude-plugin/plugin.json(seeREADME.md:51-59), so consider adding an empty config (e.g.,{ "mcpServers": {} }) for consistency even if this plugin doesn’t need external tool connections.