import { PdfViewer, PdfViewerProps } from './pdf-viewer'; import { DemoStory } from '../../demo/demo-types'; export const pdfViewerDemo: DemoStory = { id: 'pdfViewerDemo', text: 'PDF Viewer', args: { src: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf', // fallback dummy remote url for testing width: '100%', height: '600px', }, argTypes: { src: { control: 'text', description: 'PDF URL or File object' }, width: { control: 'text' }, height: { control: 'text' }, }, render: (args: any) => { const handleFileUpload = (e: any) => { const file = e.target.files[0]; if (file && file.type === 'application/pdf') { const mount = document.getElementById('pdf-viewer-mount'); if (mount) { mount.innerHTML = ''; const ViewerNode = ; // Assuming basic JSX rendering or we can manually construct it if needed, but since it's a demo render function returning VNode: // We will assign it via component pool rendering or direct iframe insertion to avoid framework binding issues here. mount.style.display = 'block'; mount.innerHTML = ``; } } else { alert('Please upload a valid PDF file.'); } }; return (
Local File Viewer

Select a PDF file from your computer to view it using the browser's built-in PDF capabilities.

No local file selected. Click the button above to upload.
Remote URL Viewer

This viewer loads a PDF remotely using the provided URL source.

); }, code: `import { PdfViewer } from "lupine.components/component-pool"; // Load from URL const el1 = ; // Or load from a File object const el2 = ; `, };