@@ -637,10 +637,10 @@ export const signPdfFun = async (
637
637
return { status : "error" , message : "something went wrong." } ;
638
638
}
639
639
}
640
- //change image width and height to 100/40 in png base64
641
- const getNewse64 = await changeImageWH ( base64Sign ) ;
642
- //remove suffiix of base64
643
- const suffixbase64 = getNewse64 && getNewse64 . split ( "," ) . pop ( ) ;
640
+ //change image width and height to 300/120 in png base64
641
+ const imagebase64 = await changeImageWH ( base64Sign ) ;
642
+ //remove suffiix of base64 (without type)
643
+ const suffixbase64 = imagebase64 && imagebase64 . split ( "," ) . pop ( ) ;
644
644
645
645
const params = {
646
646
mailProvider : activeMailAdapter ,
@@ -1169,10 +1169,7 @@ export function onSaveSign(
1169
1169
Height : posHeight ,
1170
1170
SignUrl : signatureImg ,
1171
1171
signatureType : type && type ,
1172
- options : {
1173
- ...position . options ,
1174
- response : signatureImg
1175
- }
1172
+ options : { ...position . options , response : signatureImg }
1176
1173
} ;
1177
1174
}
1178
1175
return position ;
@@ -1382,11 +1379,16 @@ export const multiSignEmbed = async (
1382
1379
const form = pdfDoc . getForm ( ) ;
1383
1380
const page = pages [ pageNo - 1 ] ;
1384
1381
const images = await Promise . all (
1385
- widgetsPositionArr . map ( async ( url ) => {
1386
- let signUrl = url . SignUrl && url . SignUrl ;
1387
- if ( signUrl ) {
1388
- const res = await fetch ( signUrl ) ;
1389
- return res . arrayBuffer ( ) ;
1382
+ widgetsPositionArr . map ( async ( widget ) => {
1383
+ // `SignUrl` this is wrong nomenclature and maintain for older code in this options we save base64 of signature image from sign pad
1384
+ let signbase64 = widget . SignUrl && widget . SignUrl ;
1385
+ if ( signbase64 ) {
1386
+ let arr = signbase64 . split ( "," ) ,
1387
+ mime = arr [ 0 ] . match ( / : ( .* ?) ; / ) [ 1 ] ;
1388
+ const res = await fetch ( signbase64 ) ;
1389
+ const arrayBuffer = await res . arrayBuffer ( ) ;
1390
+ const obj = { mimetype : mime , arrayBuffer : arrayBuffer } ;
1391
+ return obj ;
1390
1392
}
1391
1393
} )
1392
1394
) ;
@@ -1397,17 +1399,17 @@ export const multiSignEmbed = async (
1397
1399
if (
1398
1400
[ "signature" , "stamp" , "initials" , "image" ] . includes ( position . type )
1399
1401
) {
1400
- if ( position . ImageType && position . ImageType === "image/jpeg " ) {
1401
- img = await pdfDoc . embedJpg ( images [ id ] ) ;
1402
+ if ( images [ id ] . mimetype === "image/png " ) {
1403
+ img = await pdfDoc . embedPng ( images [ id ] . arrayBuffer ) ;
1402
1404
} else {
1403
- img = await pdfDoc . embedPng ( images [ id ] ) ;
1405
+ img = await pdfDoc . embedJpg ( images [ id ] . arrayBuffer ) ;
1404
1406
}
1405
1407
} else if ( ! position . type ) {
1406
1408
// to handle old widget when only stamp and signature are exists
1407
- if ( position . ImageType && position . ImageType === "image/jpeg " ) {
1408
- img = await pdfDoc . embedJpg ( images [ id ] ) ;
1409
+ if ( images [ id ] . mimetype === "image/png " ) {
1410
+ img = await pdfDoc . embedPng ( images [ id ] . arrayBuffer ) ;
1409
1411
} else {
1410
- img = await pdfDoc . embedPng ( images [ id ] ) ;
1412
+ img = await pdfDoc . embedJpg ( images [ id ] . arrayBuffer ) ;
1411
1413
}
1412
1414
}
1413
1415
let widgetWidth , widgetHeight ;
@@ -1992,15 +1994,15 @@ export const getAppLogo = async () => {
1992
1994
}
1993
1995
} ;
1994
1996
1995
- export const getTenantDetails = async ( objectId , jwttoken ) => {
1997
+ export const getTenantDetails = async ( objectId , jwttoken , contactId ) => {
1996
1998
try {
1997
1999
const url = `${ localStorage . getItem ( "baseUrl" ) } functions/gettenant` ;
1998
2000
const parseAppId = localStorage . getItem ( "parseAppId" ) ;
1999
2001
const accesstoken = localStorage . getItem ( "accesstoken" ) ;
2000
2002
const token = jwttoken
2001
2003
? { jwttoken : jwttoken }
2002
2004
: { "X-Parse-Session-Token" : accesstoken } ;
2003
- const data = jwttoken ? { } : { userId : objectId } ;
2005
+ const data = jwttoken ? { } : { userId : objectId , contactId : contactId } ;
2004
2006
const res = await axios . post ( url , data , {
2005
2007
headers : {
2006
2008
"Content-Type" : "application/json" ,
0 commit comments