Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
vercel-labs avatar

React Pdf

  • 1.7k installs
  • 15.8k repo stars
  • Updated July 8, 2026
  • vercel-labs/json-render

react-pdf generates PDF documents from JSON specs using @json-render/react-pdf.

About

The react-pdf skill renders PDF documents from JSON specs via @json-render/react-pdf built on @react-pdf/renderer. Installation uses @json-render/core plus @json-render/react-pdf npm packages. Quick start shows Spec objects with root element, Document and Page types, and renderToBuffer export for buffers, streams, or files. Agents map JSON element trees to PDF components, handle invoice or report templates, and integrate server-side PDF generation in Node or edge handlers. Use when generating PDFs from JSON specs, working with @json-render/react-pdf, or rendering structured documents programmatically. Renders PDF from JSON Spec via @json-render/react-pdf Built on @react-pdf/renderer with renderToBuffer export Install @json-render/core and @json-render/react-pdf together Spec root/elements tree maps Document, Page, and child components Supports buffers, streams, and file output for server generation react-pdf generates PDF documents from JSON specs using @json-render/react-pdf PDF buffer or file from Spec JSON using renderToBuffer and react-pdf components User mentions @json-render/react-pdf, JSON spec PDF, or renderToBuffer Teams generating invoices, reports, or PDFs from structur.

  • Renders PDF from JSON Spec via @json-render/react-pdf.
  • Built on @react-pdf/renderer with renderToBuffer export.
  • Install @json-render/core and @json-render/react-pdf together.
  • Spec root/elements tree maps Document, Page, and child components.
  • Supports buffers, streams, and file output for server generation.

React Pdf by the numbers

  • 1,681 all-time installs (skills.sh)
  • +61 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #274 of 2,277 Frontend Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

react-pdf capabilities & compatibility

Capabilities
spec to pdf mapping · rendertobuffer export · document template design · server side pdf gen · element tree composition
Works with
vercel
Use cases
pdf parsing · frontend
npx skills add https://github.com/vercel-labs/json-render --skill react-pdf

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.7k
repo stars15.8k
Security audit3 / 3 scanners passed
Last updatedJuly 8, 2026
Repositoryvercel-labs/json-render

How do I render a PDF from a JSON document spec in Node or React?

Generate PDF documents from JSON specs using @json-render/react-pdf and @react-pdf/renderer renderToBuffer.

Who is it for?

Teams generating invoices, reports, or PDFs from structured JSON specs.

Skip if: HTML-to-PDF browser printing without json-render spec model.

When should I use this skill?

User mentions @json-render/react-pdf, JSON spec PDF, or renderToBuffer.

What you get

PDF buffer or file from Spec JSON using renderToBuffer and react-pdf components.

  • PDF buffer or file from JSON Spec
  • Typed invoice or report document template

By the numbers

  • Requires @json-render/core and @json-render/react-pdf npm packages
  • Uses @react-pdf/renderer under the json-render Spec model

Files

SKILL.mdMarkdownGitHub ↗

@json-render/react-pdf

React PDF renderer that generates PDF documents from JSON specs using @react-pdf/renderer.

Installation

npm install @json-render/core @json-render/react-pdf

Quick Start

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

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

ComponentDescription
DocumentTop-level PDF wrapper (must be root)
PagePage with size (A4, LETTER), orientation, margins
ViewGeneric container (padding, margin, background, border)
Row, ColumnFlex layout with gap, align, justify
Headingh1-h4 heading text
TextBody text (fontSize, color, weight, alignment)
ImageImage from URL or base64
LinkHyperlink with text and href
TableData table with typed columns and rows
ListOrdered or unordered list
DividerHorizontal line separator
SpacerEmpty vertical space
PageNumberCurrent page number and total pages

Custom Catalog

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 }) => (
      <View style={{ backgroundColor: props.color ?? "#e5e7eb", padding: 4 }}>
        <Text>{props.label}</Text>
      </View>
    ),
  },
});

const buffer = await renderToBuffer(spec, { registry });

External Store (Controlled Mode)

Pass a StateStore for full control over state:

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:

import { schema, standardComponentDefinitions } from "@json-render/react-pdf/server";

Related skills

How it compares

Pick react-pdf when PDF layout must share the same json-render Spec schema as other render targets rather than standalone JSX-only PDF templates.

FAQ

Which packages are required?

npm install @json-render/core @json-render/react-pdf.

What is a Spec?

JSON with root id and elements map defining Document, Page, and child components.

How is PDF output produced?

renderToBuffer from @json-render/react-pdf returns PDF buffers for files or streams.

Is React Pdf safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.