summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/pengajuan-tempo/component/KonfirmasiDokumen.jsx26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/lib/pengajuan-tempo/component/KonfirmasiDokumen.jsx b/src/lib/pengajuan-tempo/component/KonfirmasiDokumen.jsx
index 112b85ef..9b0f1d8f 100644
--- a/src/lib/pengajuan-tempo/component/KonfirmasiDokumen.jsx
+++ b/src/lib/pengajuan-tempo/component/KonfirmasiDokumen.jsx
@@ -145,6 +145,7 @@ const KonfirmasiDokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
useEffect(() => {
validateDokumen();
}, [buttonSubmitClick]);
+
return (
<>
{isDesktop && (
@@ -1146,12 +1147,29 @@ const KonfirmasiDokumen = ({ chekValid, buttonSubmitClick, isKonfirmasi }) => {
width='100%'
height='100%'
/> */}
- <iframe
- src={`data:${format};base64,${base64}`}
+ <object
+ data={`data:${format};base64,${base64}`}
+ type={format}
width='100%'
height='100%'
- title='Document'
- ></iframe>
+ onError={(e) => {
+ // Jika <object> gagal menampilkan PDF, unduh otomatis
+ const link = document.createElement('a');
+ link.href = `data:${format};base64,${base64}`;
+ link.download = 'document.pdf';
+ link.click();
+ }}
+ >
+ PDF tidak dapat ditampilkan.
+ <a
+ href={`data:${format};base64,${base64}`}
+ download='document.pdf'
+ >
+ {' '}
+ Klik <span className='text-red-500'>di sini</span> untuk
+ mengunduh PDF
+ </a>
+ </object>
</div>
</BottomPopup>
)}