@@ -1033,7 +1033,9 @@ export const addInitialData = (signerPos, setXyPostion, value, userId) => {
1033
1033
//function for embed document id
1034
1034
export const embedDocId = async ( pdfDoc , documentId , allPages ) => {
1035
1035
// `fontBytes` is used to embed custom font in pdf
1036
- const fontBytes = await fileasbytes ( "/font/times.ttf" ) ;
1036
+ const fontBytes = await fileasbytes (
1037
+ "https://cdn.opensignlabs.com/webfonts/times.ttf"
1038
+ ) ;
1037
1039
pdfDoc . registerFontkit ( fontkit ) ;
1038
1040
const font = await pdfDoc . embedFont ( fontBytes , { subset : true } ) ;
1039
1041
for ( let i = 0 ; i < allPages ; i ++ ) {
@@ -1212,8 +1214,8 @@ export const fetchImageBase64 = async (imageUrl) => {
1212
1214
} ;
1213
1215
//function for select image and upload image
1214
1216
export const changeImageWH = async ( base64Image ) => {
1215
- const newWidth = 300 ;
1216
- const newHeight = 120 ;
1217
+ const newWidth = 100 ;
1218
+ const newHeight = 40 ;
1217
1219
return new Promise ( ( resolve , reject ) => {
1218
1220
const img = new Image ( ) ;
1219
1221
img . src = base64Image ;
@@ -1251,7 +1253,9 @@ export const multiSignEmbed = async (
1251
1253
containerWH
1252
1254
) => {
1253
1255
// `fontBytes` is used to embed custom font in pdf
1254
- const fontBytes = await fileasbytes ( "/font/times.ttf" ) ;
1256
+ const fontBytes = await fileasbytes (
1257
+ "https://cdn.opensignlabs.com/webfonts/times.ttf"
1258
+ ) ;
1255
1259
pdfDoc . registerFontkit ( fontkit ) ;
1256
1260
const font = await pdfDoc . embedFont ( fontBytes , { subset : true } ) ;
1257
1261
for ( let item of widgets ) {
@@ -1404,7 +1408,7 @@ export const multiSignEmbed = async (
1404
1408
width : checkboxSize ,
1405
1409
height : checkboxSize
1406
1410
} ;
1407
- checkboxObj = getWidgetPosition ( page , checkboxObj , 1 ) ;
1411
+ checkboxObj = getImagePosition ( page , checkboxObj , 1 ) ;
1408
1412
checkbox . addToPage ( page , checkboxObj ) ;
1409
1413
1410
1414
//applied which checkbox should be checked
@@ -1529,10 +1533,10 @@ export const multiSignEmbed = async (
1529
1533
width : widgetWidth ,
1530
1534
height : widgetHeight
1531
1535
} ;
1532
- dropdown . defaultUpdateAppearances ( font ) ;
1533
- const dropdownOption = getWidgetPosition ( page , dropdownObj , 1 ) ;
1534
- const dropdownSelected = { ... dropdownOption , font : font } ;
1535
- dropdown . addToPage ( page , dropdownSelected ) ;
1536
+
1537
+ const dropdownOption = getImagePosition ( page , dropdownObj , 1 ) ;
1538
+ // page.drawImage(img, imageOptions) ;
1539
+ dropdown . addToPage ( page , dropdownOption ) ;
1536
1540
dropdown . enableReadOnly ( ) ;
1537
1541
} else if ( position . type === radioButtonWidget ) {
1538
1542
const radioRandomId = "radio" + randomId ( ) ;
@@ -1573,7 +1577,7 @@ export const multiSignEmbed = async (
1573
1577
height : radioSize
1574
1578
} ;
1575
1579
1576
- radioObj = getWidgetPosition ( page , radioObj , 1 ) ;
1580
+ radioObj = getImagePosition ( page , radioObj , 1 ) ;
1577
1581
radioGroup . addOptionToPage ( item , page , radioObj ) ;
1578
1582
} ) ;
1579
1583
}
@@ -1591,7 +1595,7 @@ export const multiSignEmbed = async (
1591
1595
height : widgetHeight
1592
1596
} ;
1593
1597
1594
- const imageOptions = getWidgetPosition ( page , signature , 1 ) ;
1598
+ const imageOptions = getImagePosition ( page , signature , 1 ) ;
1595
1599
page . drawImage ( img , imageOptions ) ;
1596
1600
}
1597
1601
} ) ;
@@ -2194,8 +2198,8 @@ function compensateRotation(
2194
2198
}
2195
2199
}
2196
2200
2197
- // `getWidgetPosition ` is used to calulcate position of image type widget like x, y, width, height for pdf-lib
2198
- function getWidgetPosition ( page , image , sizeRatio ) {
2201
+ // `getImagePosition ` is used to calulcate position of image type widget like x, y, width, height for pdf-lib
2202
+ function getImagePosition ( page , image , sizeRatio ) {
2199
2203
let pageWidth ;
2200
2204
// pageHeight;
2201
2205
if ( [ 90 , 270 ] . includes ( page . getRotation ( ) . angle ) ) {
0 commit comments