Skip to content

Commit 9047aa7

Browse files
Fix Printing for mobile
1 parent d33df9b commit 9047aa7

File tree

1 file changed

+11
-0
lines changed
  • microfrontends/SignDocuments/src/Component/component

1 file changed

+11
-0
lines changed

microfrontends/SignDocuments/src/Component/component/header.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ function Header({
6060
event.preventDefault();
6161

6262
const pdf = await getBase64FromUrl(pdfUrl);
63+
const isAndroidDevice = navigator.userAgent.match(/Android/i);
64+
const isAppleDevice = (/iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream
65+
if (isAndroidDevice || isAppleDevice) {
66+
const byteArray = Uint8Array.from(atob(pdf).split('').map(char => char.charCodeAt(0)));
67+
const blob = new Blob([byteArray], { type: 'application/pdf' });
68+
const blobUrl = URL.createObjectURL(blob);
69+
window.open(blobUrl, '_blank');
70+
} else {
71+
printModule({ printable: pdf, type: "pdf", base64: true });
72+
}
73+
6374

6475
printModule({ printable: pdf, type: "pdf", base64: true });
6576
};

0 commit comments

Comments
 (0)