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!');
})();