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({
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 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+ }
114123
115124 } ;
116125
Original file line number Diff line number Diff line change @@ -60,8 +60,16 @@ function Header({
6060 event . preventDefault ( ) ;
6161
6262 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+ }
6573 } ;
6674
6775 //handle download signed pdf
You can’t perform that action at this time.
0 commit comments