@@ -942,7 +942,23 @@ export const onChangeHeightOfTextArea = (
942
942
setXyPostion ( updatePlaceholder ) ;
943
943
}
944
944
} ;
945
+ //calculate width and height
946
+ export const calculateInitialWidthHeight = ( widgetData ) => {
947
+ const intialText = widgetData ;
948
+ const span = document . createElement ( "span" ) ;
949
+ span . textContent = intialText ;
950
+ span . style . font = `14px` ; // here put your text size and font family
951
+ span . style . display = "hidden" ;
952
+ document . body . appendChild ( span ) ;
953
+ const width = span . offsetWidth ;
954
+ const height = span . offsetHeight ;
945
955
956
+ document . body . removeChild ( span ) ;
957
+ return {
958
+ getWidth : width ,
959
+ getHeight : height
960
+ } ;
961
+ } ;
946
962
export const addInitialData = ( signerPos , setXyPostion , value , userId ) => {
947
963
function widgetDataValue ( type ) {
948
964
switch ( type ) {
@@ -991,9 +1007,13 @@ export const addInitialData = (signerPos, setXyPostion, value, userId) => {
991
1007
options : {
992
1008
...item . options ,
993
1009
defaultValue : widgetData
994
- } ,
995
- Width : calculateInitialWidthHeight ( item . type , widgetData ) . getWidth ,
996
- Height : calculateInitialWidthHeight ( item . type , widgetData ) . getHeight
1010
+ }
1011
+ // Width:
1012
+ // calculateInitialWidthHeight(item.type, widgetData).getWidth ||
1013
+ // item?.Width,
1014
+ // Height:
1015
+ // calculateInitialWidthHeight(item.type, widgetData).getHeight ||
1016
+ // item?.Height
997
1017
} ;
998
1018
} else {
999
1019
return {
@@ -1004,24 +1024,6 @@ export const addInitialData = (signerPos, setXyPostion, value, userId) => {
1004
1024
} ) ;
1005
1025
} ;
1006
1026
1007
- //calculate width and height
1008
- export const calculateInitialWidthHeight = ( widgetData ) => {
1009
- const intialText = widgetData ;
1010
- const span = document . createElement ( "span" ) ;
1011
- span . textContent = intialText ;
1012
- span . style . font = `14px` ; // here put your text size and font family
1013
- span . style . display = "hidden" ;
1014
- document . body . appendChild ( span ) ;
1015
- const width = span . offsetWidth ;
1016
- const height = span . offsetHeight ;
1017
-
1018
- document . body . removeChild ( span ) ;
1019
- return {
1020
- getWidth : width ,
1021
- getHeight : height
1022
- } ;
1023
- } ;
1024
-
1025
1027
//function for embed document id
1026
1028
export const embedDocId = async ( pdfDoc , documentId , allPages ) => {
1027
1029
for ( let i = 0 ; i < allPages ; i ++ ) {
0 commit comments