The react-pdf skill allows developers to easily display PDF documents in their React applications. It is ideal for those looking to integrate PDF viewing capabilities into their web projects.
$ npx skills add https://github.com/molefrog/skills --skill react-pdfThe react-pdf skill enables developers to create PDF documents programmatically using React components and the @react-pdf/renderer library. It provides Flexbox and grid layout capabilities powered by Yoga, eliminating coordinate-based positioning, and includes first-class SVG primitives for inline charts and icons. The skill supports Google Fonts registration, professional Knuth-Plass line breaking, smart page breaks with orphan/widow control, and emoji support. It solves the challenge of AI-generated document creation by offering declarative, composable component patterns familiar to React developers.
Install the skill using the command provided.
Display PDF documents in a React application
Generate downloadable PDFs from React components
Create PDF portfolios with custom layouts
$ npx skills add https://github.com/molefrog/skills --skill react-pdfgit clone https://github.com/molefrog/skillsCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Generate React code to display a PDF file named '[FILE_NAME].pdf' in a [COMPANY] web application using the react-pdf library. Ensure the PDF viewer is responsive and includes basic controls like zoom and page navigation. Use [INDUSTRY]-specific styling if applicable.
# Displaying PDF in [COMPANY] Dashboard
Here’s a React component to embed a PDF viewer in your application:
```jsx
import { Document, Page, pdfjs } from 'react-pdf';
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
import 'react-pdf/dist/esm/Page/TextLayer.css';
// Set up PDF worker (required for react-pdf)
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.min.js`;
const PDFViewer = ({ fileName = 'annual-report.pdf' }) => {
return (
<div className="pdf-container" style={{ maxWidth: '800px', margin: '0 auto' }}>
<Document file={fileName}>
<Page pageNumber={1} scale={1.2} />
</Document>
<div className="pdf-controls" style={{ marginTop: '1rem', textAlign: 'center' }}>
<button onClick={() => window.print()}>Print</button>
<button onClick={() => console.log('Download clicked')}>Download</button>
</div>
</div>
);
};
export default PDFViewer;
```
### Key Features:
- **Responsive Design**: Adapts to container width.
- **Basic Controls**: Print and download buttons (download logic can be expanded).
- **Optimized Rendering**: Uses `react-pdf` for efficient PDF parsing.
### Usage:
```jsx
<PDFViewer fileName="quarterly-financials.pdf" />
```Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan