GitHub
ViewerPDFViewer

PDFViewer

Web only

Iframe PDF viewer for client-side generated documents.

import { PDFViewer, Document, Page, Text } from '@react-pdf/renderer';

const App = () => (
  <PDFViewer style={{ width: '100%', height: '90vh' }}>
    <Document>
      <Page size="A4">
        <Text>Rendered in the browser</Text>
      </Page>
    </Document>
  </PDFViewer>
);

Valid props

Prop nameDescriptionTypeDefault
styleDefines iframe stylesObject, Arrayundefined
classNameDefines iframe class name_String _undefined
childrenPDF document implementationDocumentundefined
widthWidth of embedded PDF iframeString, Numberundefined
heightHeight of embedded PDF iframeString, Numberundefined
innerRefRef to the underlying iframe elementRefundefined
showToolbarRender the toolbar. Supported on Chrome, Edge and SafariBooleantrue

Other props are passed through to the iframe.

On this page