Skip to content

Commit d33df9b

Browse files
Fix Print for mobile
1 parent 3164ee5 commit d33df9b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,16 @@ function EmailComponent({
109109
const handleToPrint = async (event) => {
110110
event.preventDefault();
111111

112-
const base64 = await getBase64FromUrl(pdfUrl);
113-
printModule({ printable: base64, type: "pdf", base64: true });
112+
const isAndroidDevice = navigator.userAgent.match(/Android/i);
113+
const isAppleDevice = (/iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream
114+
if (isAndroidDevice || isAppleDevice) {
115+
const byteArray = Uint8Array.from(atob(pdf).split('').map(char => char.charCodeAt(0)));
116+
const blob = new Blob([byteArray], { type: 'application/pdf' });
117+
const blobUrl = URL.createObjectURL(blob);
118+
window.open(blobUrl, '_blank');
119+
} else {
120+
printModule({ printable: pdf, type: "pdf", base64: true });
121+
}
114122

115123
};
116124

0 commit comments

Comments
 (0)