GitHub
github.com › wojtekmaj › react-pdf
GitHub - wojtekmaj/react-pdf: Display PDFs in your React app as easily as if they were images.
This package is used to display existing PDFs. If you wish to create PDFs using React, you may be looking for @react-pdf/renderer.
Starred by 10.7K users
Forked by 981 users
Languages TypeScript 94.3% | CSS 5.6% | HTML 0.1%
CodeSandbox
codesandbox.io › examples › package › react-pdf
react-pdf examples - CodeSandbox
AboutDisplay PDFs in your React app as easily as if they were images.2,318,614Weekly Downloads · Latest version10.2.0 · LicenseMIT · External Links · github.com/wojtekmaj/react-pdf ·
CodePen
codepen.io › akfish › pen › LNWXrM
React + PDF.js
const PDF_URL = 'https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf' class PDF extends React.Component { constructor (props) { super(props) this.state = { pdf: null, scale: 1.2 } } getChildContext () { return { pdf: this.state.pdf, scale: this.state.scale } } componentDidMount () { PDFJS.getDocument(this.props.src).then((pdf) => { console.log(pdf) this.setState({ pdf }) }) } render () { return (<div className='pdf-context'>{this.props.children}</div>) } } PDF.propTypes = { src: React.PropTypes.string.isRequired } PDF.childContextTypes = { pdf: React.PropTypes.object, scale
React-pdf
react-pdf.org
React-pdf
React renderer for creating PDF files on the browser and server
GitHub
github.com › 0xjjpa › pdf-viewer
GitHub - 0xjjpa/pdf-viewer: 📄 React + PDF.js / Upload and preview PDF files in your browser
📄 React + PDF.js Experiment. Submission for /r/codingprompts (Week 2). Preview and load PDF documents to read them in your browser. ... Works in Chrome + Firefox + Safari, untested in IE. Feel free to play around with the code at Codepen.io!
Starred by 10 users
Forked by 4 users
Languages JavaScript 98.1% | CSS 1.7% | HTML 0.2%
CodePen
codepen.io › zhanglongtai › embed › RGVJvp
CodePen Embed - React + PDF.js
const PDF_URL = 'https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf' class PDF extends React.Component { constructor (props) { super(props) this.state = { pdf: null, scale: 1.2 } } getChildContext () { return { pdf: this.state.pdf, scale: this.state.scale } } componentDidMount () { PDFJS.getDocument(this.props.src).then((pdf) => { console.log(pdf) this.setState({ pdf }) }) } render () { return (<div className='pdf-context'>{this.props.children}</div>) } } PDF.propTypes = { src: React.PropTypes.string.isRequired } PDF.childContextTypes = { pdf: React.PropTypes.object, scale
CodeSandbox
codesandbox.io › examples › package › @react-pdf › renderer
react-pdf/renderer examples
react-pdf · Find more examples or templates · AboutCreate PDF files on the browser and server1,409,713Weekly Downloads · Latest version4.3.1 · LicenseMIT · External Links · github.com/diegomura/react-pdf#readme · github.com/diegomura/react-pdf · github.com/diegomura/react-pdf/issues ·
CodeSandbox
codesandbox.io › examples › package › react-pdf-js
react-pdf-js examples - CodeSandbox
Use this online react-pdf-js playground to view and fork react-pdf-js example apps and templates on CodeSandbox.
CodePen
codepen.io › mjunaidi › pen › XomOQz
ReactJS: jsPDF - print with Style
console.clear() class Boilerplate extends React.Component { state={} render() { return ( <div> </div> ) } } const data = { firstName: 'john', lastName: 'donohue', email: '[email protected]', } class App extends React.Component { state={} componentDidMount() { this.setup() } download=event=>{ this.doc.save('sample.pdf') } setup() { const doc = new jsPDF() const el = document.getElementById('content') if (typeof(el)==='object'&&el!==null) { const width = 170 const elementHandlers = { '#ignorePDF': (element,renderer)=>{ return true } } doc.fromHTML(el,15,15,{width,elementHandlers},()=>{
Snyk
snyk.io › advisor › react-pdf › react-pdf code examples
Top 5 react-pdf Code Examples | Snyk
doches / lilypond-ui / src / renderer / output.tsx View on Github · import * as React from "react"; import * as ReactPDF from "react-pdf"; import Pagination from "react-js-pagination"; import { Spinner, Intent, NonIdealState, } from "@blueprintjs/core"; import Toast from "./toast"; ReactPDF.pdfjs.GlobalWorkerOptions.workerSrc = "../dist/pdf.worker.js"; import "./output.less"; const translateScale = (scale: string) => { if (scale.indexOf("%") > -1) { return (+scale.replace(/[^\d]+/g, ""))/100.0; } return 1; } export interface IOutputProps { path: string; needsRefresh: boolean; hasErrors: boolean; showPendingSpinner: boolean;
GitHub
github.com › diegomura › react-pdf
GitHub - diegomura/react-pdf: 📄 Create PDF files using React
import React from 'react'; import ReactPDF from '@react-pdf/renderer'; ReactPDF.render(<MyDocument />, `${__dirname}/example.pdf`);
Starred by 16.2K users
Forked by 1.3K users
Languages TypeScript 83.1% | JavaScript 16.8%
CodePen
codepen.io › vana › pen › RXZMQG
pdf renderer
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing. If active, Pens will autosave every 30 seconds after being saved once. If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update. If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting. ... Visit your global Editor Settings. ... <script src="//mozilla.github.io/pdf.js/build/pdf.js"></script> <a href="#">Click to view</a> <div class="overlay"></div> <canvas id="the-canvas"></canvas> </div>
CodePen
codepen.io › tcyrus › embed › jKoQyv
CodePen Embed - Bootstrap 4 + React + PDF.js
const { Component, PureComponent, createContext } = React; const { render } = ReactDOM; const PDF_URL = "//mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf"; const SCALE = 5.0; class PDFViewer extends Component { state = { pdf: null } static propTypes = { src: PropTypes.string.isRequired } componentDidMount() { pdfjsLib.getDocument(this.props.src).then((pdf) => { this.setState({ pdf }); }); } render() { const { pdf, activeIndex } = this.state; const numPages = pdf ?
Nutrient
nutrient.io › blog › sdk › how to build a reactjs pdf viewer with react pdf
React PDF viewer: Complete guide to building with react-pdf in 2025
August 12, 2025 - One of the disadvantages of using react-pdf is that it doesn’t come with a UI. In this example, you’ve rendered two buttons to navigate between pages and showed the total number of pages. Your browser doesn't support HTML5 video. Here is a link to the video instead. You can access the full code on GitHub(opens in a new tab).
npm
npmjs.com › package › react-pdf
react-pdf - npm
React-PDF is under constant development. This documentation is written for React-PDF 9.x branch. If you want to see documentation for other versions of React-PDF, use dropdown on top of GitHub page to switch to an appropriate tag.
» npm install react-pdf
Published Oct 09, 2025
Version 10.2.0
Author Wojciech Maj
Repository https://github.com/wojtekmaj/react-pdf
GitHub
github.com › ivmarcos › react-to-pdf
GitHub - ivmarcos/react-to-pdf: Generate pdf from react components
You probably will not need this and things can break, // so use with caution. overrides: { // see https://artskydj.github.io/jsPDF/docs/jsPDF.html for more options pdf: { compress: true }, // see https://html2canvas.hertzen.com/configuration for more options canvas: { useCORS: true } }, }; // you can use a function to return the target element besides using React refs const getTargetElement = () => document.getElementById('content-id'); const Component = () => { return ( <div> <button onClick={() => generatePDF(getTargetElement, options)}>Generate PDF</button> <div id="content-id"> Content to be generated to PDF </div> </div> ); }
Starred by 329 users
Forked by 67 users
Languages TypeScript 93.2% | JavaScript 5.7% | HTML 1.1%
GitHub
github.com › michaeldzjap › react-pdf-sample
GitHub - michaeldzjap/react-pdf-sample: A react-pdf + react-window Sample Project
A react-pdf + react-window Sample Project. Contribute to michaeldzjap/react-pdf-sample development by creating an account on GitHub.
Starred by 44 users
Forked by 11 users
Languages JavaScript 81.9% | SCSS 14.4% | HTML 3.7%
GitHub
github.com › mikecousins › react-pdf-js
GitHub - mikecousins/react-pdf-js: A React component to wrap PDF.js
import React, { useState, useRef } from 'react'; import { usePdf } from '@mikecousins/react-pdf'; const MyPdfViewer = () => { const [page, setPage] = useState(1); const canvasRef = useRef(null); const { pdfDocument, pdfPage } = usePdf({ file: 'test....
Starred by 799 users
Forked by 151 users
Languages TypeScript 90.7% | JavaScript 6.9% | CSS 2.0% | HTML 0.4%