npm
npm install pdf-preview-link React library
PDF Preview Link renders the first page on hover so users can validate documents instantly before opening a new tab.
Try live playgroundLive demo
See the first page preview immediately without opening another screen.
Open interactive controlsInstall from npm or load the UMD build from a CDN.
npm install pdf-preview-link <script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/pdf-preview-link/dist/index.umd.js"></script> | Option | Type | Default | Description |
|---|---|---|---|
| href | string | required | PDF URL used to generate the preview. |
| width | number | 300 | Popup width in pixels. |
| height | number | 400 | Popup height in pixels. |
| delay | number | 300 | Hover delay before opening preview. |
| position | 'auto' | 'top' | 'bottom' | 'left' | 'right' | 'auto' | Preferred popup placement. |
| offset | number | 8 | Distance between link and popup. |
| scale | number | 1.5 | Render quality factor for PDF preview image. |
Explore variants in real time and copy the generated snippet directly into your project.
Ajusta opciones y revisa el comportamiento del preview en tiempo real.
Live output
<PDFPreviewLink
href="https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf"
previewOptions={{
width: 280,
height: 360,
delay: 220,
offset: 8,
scale: 1.4,
position: 'right',
}}
>
Ver documento
</PDFPreviewLink>