try using embed instaed of object to fix apple view

This commit is contained in:
Dobromir Popov
2024-03-04 12:42:38 +02:00
parent 4f13ac7bd8
commit 34cf8732e1

View File

@ -25,7 +25,7 @@ const PDFViewerPage = () => {
};
return (
<Layout>
<Layout><script src="https://mozilla.github.io/pdf.js/dist/pdf.js"></script>
<h1 className="text-3xl font-bold">Напътствия</h1>
<div className="guidelines-section mb-5 p-4 bg-gray-100 rounded-lg">
<h2 className="text-2xl font-semibold mb-3">Важни напътствия за службата</h2>
@ -59,12 +59,17 @@ const PDFViewerPage = () => {
</React.Fragment>
))}
</div>
<div style={{ width: 'calc(100% - 1rem)', height: '100%', margin: '0 0' }}> {/* Center the PDF with 2rem margin */}
<object data={pdfFile} type="application/pdf" style={{ width: '100%', height: '100%' }}>
<div style={{ width: 'calc(100% - 1rem)', height: '100%', margin: '0 0' }}>
<embed src={pdfFile} type="application/pdf" style={{ width: '100%', height: '100%' }} />
{/* <object data={pdfFile} type="application/pdf" page="2" style={{ width: '100%', height: '100%' }}>
<p>Your browser does not support PDFs. Please download the PDF to view it: <a href={pdfFile}>Свали PDF файла</a>.</p>
<p>Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: <a href={pdfFile}>Свали PDF файла</a>.</p>
</object>
</object> */}
</div>
{/* <iframe src={`https://docs.google.com/gview?url=${baseUrl}${pdfFile}&embedded=true`} style={{ width: '100%', height: '100%' }} frameBorder="0"></iframe> */}
</div>
</Layout >
);