Generate PPTX presentations, DOCX documents, XLSX spreadsheets, and PDF reports from structured JSON input using PaperJSX.
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-paperjsx-601104d81c8f ,按照其中的说明把「paperjsx」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Generate professional documents from JSON layout specs. PaperJSX is generation-only — it creates new files, it does not edit existing ones.
Use this skill when the user asks to:
Install the format-appropriate package:
# Presentations
npm install @paperjsx/json-to-pptx
# Word documents
npm install @paperjsx/json-to-docx
# Spreadsheets
npm install @paperjsx/json-to-xlsx
# PDF documents
npm install @paperjsx/json-to-pdf
references/json-schema.mdDo not write imperative PaperJSX API code. The execution model is always: JSON spec in, document file out.
import { PaperEngine } from "@paperjsx/json-to-pptx";
import fs from "node:fs";
const spec = {
type: "Document",
meta: { title: "Q4 Review" },
slides: [
{
type: "Slide",
children: [
{ type: "Text", content: "Q4 2025 Business Review", style: { fontSize: 36, bold: true } }
]
}
]
};
const buffer = await PaperEngine.render(spec);
fs.writeFileSync("presentation.pptx", buffer);
console.log("Generated presentation.pptx");
import { renderToDocx } from "@paperjsx/json-to-docx";
import fs from "node:fs";
const result = await renderToDocx({
type: "DocxDocument",
pageSize: "a4",
orientation: "portrait",
pages: [
{
elements: [
{ type: "heading", level: 1, text: "Quarterly Report" },
{ type: "paragraph", text: "Section content here." }
]
}
]
});
fs.writeFileSync("report.docx", result.buffer);
console.log("Generated report.docx");
import { SpreadsheetEngine } from "@paperjsx/json-to-xlsx";
import fs from "node:fs";
const spec = {
meta: { title: "Revenue Data", creator: "PaperJSX" },
sheets: [{
name: "Revenue",
rows: [
{ cells: [{ value: "Quarter" }, { value: "Revenue" }] },
{ cells: [{ value: "Q1 2026" }, { value: 420000 }] },
{ cells: [{ value: "Q2 2026" }, { value: 510000 }] }
]
}]
};
const buffer = await SpreadsheetEngine.render(spec);
fs.writeFileSync("revenue.xlsx", buffer);
console.log("Generated revenue.xlsx");
After generating any file, always verify:
import fs from "node:fs";
const stats = fs.statSync("output.pptx");
if (stats.size === 0) {
throw new Error("Generated file is empty");
}
console.log(`Output file: ${stats.size} bytes`);
If the engine throws an error, surface the full error message to the user.
See references/json-schema.md for the complete JSON layout spec schema for all supported formats.