Skip to content

ViewPdf

The ViewPdf component displays PDF documents using an iframe. It supports PDF files from URLs, base64 encoded strings, or data URIs.

The component automatically detects the format of the input and handles it appropriately.

// Import component
import { ViewPdf } from '@fintech-sandpit/ui/react';
// Import styles (optional)
import '@fintech-sandpit/ui/style/components/view_pdf.css';
// With URL
const pdfUrl = 'https://example.com/document.pdf';
return (
<ViewPdf src={pdfUrl} />
);
import { ViewPdf } from '@fintech-sandpit/ui/react';
const base64 = 'JVBERi0xLjQKJeLjz9MK...';
return (
<ViewPdf src={base64} />
);
import { ViewPdf } from '@fintech-sandpit/ui/react';
const dataUri = 'data:application/pdf;base64,JVBERi0xLjQKJeLjz9MK...';
return (
<ViewPdf src={dataUri} />
);
NameTypeRequiredDefaultDescription
srcstringYes—The PDF source. Can be a URL, base64 string, or data URI. The component automatically detects the format.
titlestringNoPDF documentThe title of the PDF document.