跳到主内容
智客 ZICQ

技能库 智客分类:文档办公 react-pdf

React Pdf

Json - relands 重现 PDF 渲染器 。 从JSON specs生成PDF文档时使用,与@json-render/react-pdf合作,或将 specs 渲染到PDF缓冲/流/文件.

2146 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

Json- reland 的 PDF 渲染器

何时用

从 JSON 光谱生成 PDF 文档, 与 @json- render/ react-pdf 合作, 或向 PDF 缓冲/ 流/ 文件渲染光谱

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:@json-render/react-pdf、Installation、Quick Start、Render APIs、Standard Components、Custom Catalog。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。

官方 description(原文)

React PDF renderer for json-render. Use when generating PDF documents from JSON specs, working with @json-render/react-pdf, or rendering specs to PDF buffers/streams/files.

@json-render/react-pdfInstallationQuick StartRender APIsStandard ComponentsCustom CatalogExternal Store (Controlled Mode)Server-Safe Import

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
react-pdf
description
React PDF renderer for json-render. Use when generating PDF documents from JSON specs, working with @json-render/react-pdf, or rendering specs to PDF buffers/streams/files.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「react-pdf」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-00c7ded442b04042-%E5%8F%8D%E5%BA%94-Pdf.html
请存为 .cursor/skills/react-pdf/SKILL.md 或 .claude/skills/react-pdf/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/vercel-labs/json-render' --list

npx skills add 'https://github.com/vercel-labs/json-render' --skill 'react-pdf'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: react-pdf description: React PDF renderer for json-render. Use when generating PDF documents from JSON specs, working with @json-render/react-pdf, or rendering specs to PDF buffers/streams/files. --- # @json-render/react-pdf React PDF renderer that generates PDF documents from JSON specs using `@react-pdf/renderer`. ## Installation ```bash npm install @json-render/core @json-render/react-pdf ``` ## Quick Start ```typescript import { renderToBuffer } from "@json-render/react-pdf"; import type { Spec } from "@json-render/core"; const spec: Spec = { root: "doc", elements: { doc: { type: "Document", props: { title: "Invoice" }, children: ["page"] }, page: { type: "Page", props: { size: "A4" }, children: ["heading", "table"], }, heading: { type: "Heading", props: { text: "Invoice #1234", level: "h1" }, children: [], }, table: { type: "Table", props: { columns: [ { header: "Item", width: "60%" }, { header: "Price", width: "40%", align: "right" }, ], rows: [ ["Widget A", "$10.00"], ["Widget B", "$25.00"], ], }, children: [], }, }, }; const buffer = await renderToBuffer(spec); ``` ## Render APIs ```typescript import { renderToBuffer, renderToStream, renderToFile } from "@json-render/react-pdf"; // In-memory buffer const buffer = await renderToBuffer(spec); // Readable stream (pipe to HTTP response) const stream = await renderToStream(spec); stream.pipe(res); // Direct to file await renderToFile(spec, "./output.pdf"); ``` All render functions accept an optional second argument: `{ registry?, state?, handlers? }`. ## Standard Components | Component | Description | |-----------|-------------| | `Document` | Top-level PDF wrapper (must be root) | | `Page` | Page with size (A4, LETTER), orientation, margins | | `View` | Generic container (padding, margin, background, border) | | `Row`, `Column` | Flex layout with gap, align, justify | | `Heading` | h1-h4 heading text | | `Text` | Body text (fontSize, color, weight, alignment) | | `Image` | Image from URL or base64 | | `Link` | Hyperlink with text and href | | `Table` | Data table with typed columns and rows | | `List` | Ordered or unordered list | | `Divider` | Horizontal line separator | | `Spacer` | Empty vertical space | | `PageNumber` | Current page number and total pages | ## Custom Catalog ```typescript import { defineCatalog } from "@json-render/core"; import { schema, defineRegistry, renderToBuffer } from "@json-render/react-pdf"; import { standardComponentDefinitions } from "@json-render/react-pdf/catalog"; import { z } from "zod"; const catalog = defineCatalog(schema, { components: { ...standardComponentDefinitions, Badge: { props: z.object({ label: z.string(), color: z.string().nullable() }), slots: [], description: "A colored badge label", }, }, actions: {}, }); const { registry } = defineRegistry(catalog, { components: { Badge: ({ props }) => ( {props.label} ), }, }); const buffer = await renderToBuffer(spec, { registry }); ``` ## External Store (Controlled Mode) Pass a `StateStore` for full control over state: Nested lists can set `repeat.statePath` to `{ "$item": "field" }` inside an enclosing repeat. ```typescript import { createStateStore } from "@json-render/react-pdf"; const store = createStateStore({ invoice: { total: 100 } }); store.set("/invoice/total", 200); ``` ## Server-Safe Import Import schema and catalog without pulling in React: ```typescript import { schema, standardComponentDefinitions } from "@json-render/react-pdf/server"; ```

相关技能

文档办公

Ontology

为结构化的代理内存和可堆肥技能所打入的知识图. 在创建/征服实体(Person, project, Task, Evention, Document)时使用,链接相关对象,强制约束,规划多步动作作为图变,或技能需要共享状态时使用. 触发到"记住","我知道什么","链接X到Y",…

文档办公

Nano Pdf

使用纳米-pdf CLI编辑带有自然语言指令的PDF.

文档办公

Word / DOCX

创建,检查,并编辑有可靠样式的Microsoft Word文档和DOCX文件,编号,跟踪更改,表格,章节,并进行相容性检查. 当 (1) 任务涉及 Word 或 ".docx " 时使用; (2) 文件包括跟踪的更改,评论,字段,表格,模板,或页面布局限制; (3) 文档必须在不…

文档办公

Api Gateway

通过 Maton 网关调用第三方 API, 它为用户已经连接的应用程序注入证书 。 当用户命名一个连接的应用程序和其中的具体行动时使用此技能——读取一个邮箱,查询一个CMM,归档一个问题,更新一个电子表格,通过一个连接的搜索或刮取提供者运行一个查询. 每一次通话都到用户连接的应用…