Skip to content

πŸ”₯ The free & Open Source DocuSign alternative

Fix Printing for mobile

Rishab9047aa7dc868
diff --git a/microfrontends/SignDocuments/src/Component/component/header.js b/microfrontends/SignDocuments/src/Component/component/header.js
index bccdd46f2..41f2a4419 100644
--- a/microfrontends/SignDocuments/src/Component/component/header.js
+++ b/microfrontends/SignDocuments/src/Component/component/header.js
@@ -60,6 +60,17 @@ function Header({
event.preventDefault();
const pdf = await getBase64FromUrl(pdfUrl);
+ const isAndroidDevice = navigator.userAgent.match(/Android/i);
+ const isAppleDevice = (/iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream
+ if (isAndroidDevice || isAppleDevice) {
+ const byteArray = Uint8Array.from(atob(pdf).split('').map(char => char.charCodeAt(0)));
+ const blob = new Blob([byteArray], { type: 'application/pdf' });
+ const blobUrl = URL.createObjectURL(blob);
+ window.open(blobUrl, '_blank');
+ } else {
+ printModule({ printable: pdf, type: "pdf", base64: true });
+ }
+
printModule({ printable: pdf, type: "pdf", base64: true });
};