react-pdf

Generate PDF documents using React-PDF with TypeScript and JSX.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/cpfcoaching/glowing-palm-tree --skill react-pdf-cpfcoaching
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-pdf
Source: https://github.com/cpfcoaching/glowing-palm-tree/tree/main/.skills_backup/react-pdf
Command: npx skills add https://github.com/cpfcoaching/glowing-palm-tree --skill react-pdf-cpfcoaching

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires react, @react-pdf/renderer, tsx, @types/react, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill streamlines the creation of PDF documents from React applications, offering a robust solution for generating reports, invoices, forms, resumes, and more with ease.

Core Features & Use Cases

  • React-PDF Integration: Leverages the React-PDF library for TypeScript and JSX-based PDF generation.
  • Custom Layouts: Supports complex layouts, including flexbox, SVG graphics, custom fonts, and professional typesetting.
  • Use Case: Ideal for creating visually appealing PDFs for professional purposes, such as generating certificates, reports, or presentations.

Quick Start

Create a new PDF document with the following JSX:

import React from 'react';
import { Document, Page, Text, View, StyleSheet, renderToFile } from '@react-pdf/renderer';

const styles = StyleSheet.create({
  page: { flexDirection: 'column', backgroundColor: '#ffffff', padding: 40 },
  title: { fontSize: 24, marginBottom: 20, fontWeight: 'bold' },
  text: { fontSize: 12, lineHeight: 1.5 },
});

const MyDocument = () => (
  <Document>
    <Page size="A4" style={styles.page}>
      <View style={{ margin: 10, padding: 20 }}>
        <Text style={styles.title}>Document Title</Text>
        <Text style={styles.text}>Your content here</Text>
      </View>
    </Page>
  </Document>
);

(async () => {
  await renderToFile(<MyDocument />, './output.pdf');
  console.log('PDF saved!');
})();

Frequently Asked Questions about react-pdf

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate PDF documents from a React application using TypeScript?

To generate PDF documents from a React application, you can use the @react-pdf/renderer library with TypeScript and JSX to define layouts and render them directly to PDF files. It handles complex layouts, custom fonts, and SVG graphics for professional output.

What's the best way to create custom invoices and reports in React?

The best way to create custom invoices and reports in React is using @react-pdf/renderer, which supports JSX-based components, flexbox layouts, and custom fonts to produce visually appealing PDF documents for professional purposes.

Can I use flexbox and custom fonts for PDF generation in React?

Yes, you can use flexbox and custom fonts for PDF generation in React. The @react-pdf/renderer library supports complex layouts including flexbox styling, SVG graphics, and custom fonts to ensure professional typesetting in your documents.

Does PDF generation with @react-pdf/renderer require React as a dependency?

Yes, PDF generation with @react-pdf/renderer requires React as a dependency. You also need tsx and @types/react to execute the TypeScript-based JSX rendering process and generate your final PDF output file.

Why does my React PDF generation fail to render complex document layouts?

React PDF generation of complex document layouts requires proper JSX structuring using Document and Page components from @react-pdf/renderer. You must define StyleSheet objects correctly and ensure React is installed to execute the renderToFile function successfully.