File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
microfrontends/SignDocuments/src/Component/component Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -109,8 +109,17 @@ function EmailComponent({
109
109
const handleToPrint = async ( event ) => {
110
110
event . preventDefault ( ) ;
111
111
112
- const base64 = await getBase64FromUrl ( pdfUrl ) ;
113
- printModule ( { printable : base64 , type : "pdf" , base64 : true } ) ;
112
+ const pdf = await getBase64FromUrl ( pdfUrl ) ;
113
+ const isAndroidDevice = navigator . userAgent . match ( / A n d r o i d / i) ;
114
+ const isAppleDevice = ( / i P a d | i P h o n e | i P o d / . test ( navigator . platform ) || ( navigator . platform === 'MacIntel' && navigator . maxTouchPoints > 1 ) ) && ! window . MSStream
115
+ if ( isAndroidDevice || isAppleDevice ) {
116
+ const byteArray = Uint8Array . from ( atob ( pdf ) . split ( '' ) . map ( char => char . charCodeAt ( 0 ) ) ) ;
117
+ const blob = new Blob ( [ byteArray ] , { type : 'application/pdf' } ) ;
118
+ const blobUrl = URL . createObjectURL ( blob ) ;
119
+ window . open ( blobUrl , '_blank' ) ;
120
+ } else {
121
+ printModule ( { printable : pdf , type : "pdf" , base64 : true } ) ;
122
+ }
114
123
115
124
} ;
116
125
Original file line number Diff line number Diff line change @@ -60,8 +60,16 @@ function Header({
60
60
event . preventDefault ( ) ;
61
61
62
62
const pdf = await getBase64FromUrl ( pdfUrl ) ;
63
-
64
- printModule ( { printable : pdf , type : "pdf" , base64 : true } ) ;
63
+ const isAndroidDevice = navigator . userAgent . match ( / A n d r o i d / i) ;
64
+ const isAppleDevice = ( / i P a d | i P h o n e | i P o d / . 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
+ }
65
73
} ;
66
74
67
75
//handle download signed pdf
You can’t perform that action at this time.
0 commit comments