diff --git a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js
index b831176fe..800ef7adf 100644
--- a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js
+++ b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js
@@ -4,6 +4,8 @@ import ModalUi from "../../primitives/ModalUi";
import { radioButtonWidget } from "../../constant/Utils";
import Upgrade from "../../primitives/Upgrade";
import { useTranslation } from "react-i18next";
+import { fontColorArr, fontsizeArr } from "../../constant/Utils";
+
function DropdownWidgetOption(props) {
const { t } = useTranslation();
const [dropdownOptionList, setDropdownOptionList] = useState([
@@ -330,6 +332,55 @@ function DropdownWidgetOption(props) {
>
)}
+
{!props.isSignYourself && (
@@ -362,6 +413,7 @@ function DropdownWidgetOption(props) {
)}
+
+
{props.pos?.options?.name
? props.pos.options.name
: widgetTypeTraslation}
@@ -778,7 +821,17 @@ function PlaceholderType(props) {
}}
/>
{!props.pos.options?.isHideLabel && (
-
+
)}
);
diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js
index 8434550f1..be604518b 100644
--- a/apps/OpenSign/src/constant/Utils.js
+++ b/apps/OpenSign/src/constant/Utils.js
@@ -1241,6 +1241,21 @@ const calculateFontSize = (position, containerScale, signyourself) => {
return font / containerScale;
}
};
+
+const getWidgetsFontColor = (type) => {
+ switch (type) {
+ case "red":
+ return rgb(1, 0, 0);
+ case "black":
+ return rgb(0, 0, 0);
+ case "blue":
+ return rgb(0, 0, 1);
+ case "yellow":
+ return rgb(0.9, 1, 0);
+ default:
+ return rgb(0, 0, 0);
+ }
+};
//function for embed multiple signature using pdf-lib
export const multiSignEmbed = async (
widgets,
@@ -1347,6 +1362,8 @@ export const multiSignEmbed = async (
return resizePos;
}
};
+ const color = position?.options?.fontColor;
+ let updateColorInRgb = getWidgetsFontColor(color);
const widgetTypeExist = [
textWidget,
textInputWidget,
@@ -1359,7 +1376,7 @@ export const multiSignEmbed = async (
if (position.type === "checkbox") {
let checkboxOptionGapFromTop, isCheck;
let y = yPos(position);
- const optionsFontSize = 13;
+ const optionsFontSize = parseInt(position?.options?.fontSize) || 13;
const checkboxSize = 18;
const checkboxTextGapFromLeft = 22;
if (position?.options?.values.length > 0) {
@@ -1394,7 +1411,8 @@ export const multiSignEmbed = async (
optionsFontSize,
rgb(0, 0, 0),
font,
- page
+ page,
+ updateColorInRgb
);
page.drawText(item, optionsPosition);
}
@@ -1423,20 +1441,6 @@ export const multiSignEmbed = async (
signyourself
);
parseInt(fontSize);
-
- const color = position?.options?.fontColor;
- let updateColorInRgb;
- if (color === "red") {
- updateColorInRgb = rgb(1, 0, 0);
- } else if (color === "black") {
- updateColorInRgb = rgb(0, 0, 0);
- } else if (color === "blue") {
- updateColorInRgb = rgb(0, 0, 1);
- } else if (color === "yellow") {
- updateColorInRgb = rgb(0.9, 1, 0);
- } else {
- updateColorInRgb = rgb(0, 0, 0);
- }
let textContent;
if (position?.options?.response) {
textContent = position.options?.response;
@@ -1515,30 +1519,40 @@ export const multiSignEmbed = async (
y += 18; // Adjust the line height as needed
}
} else if (position.type === "dropdown") {
+ const fontsize = parseInt(position?.options?.fontSize) || 12;
+
const dropdownRandomId = "dropdown" + randomId();
const dropdown = form.createDropdown(dropdownRandomId);
+
dropdown.addOptions(position?.options?.values);
if (position?.options?.response) {
dropdown.select(position.options?.response);
} else if (position?.options?.defaultValue) {
dropdown.select(position?.options?.defaultValue);
}
+
+ dropdown.setFontSize(12);
const dropdownObj = {
x: xPos(position),
y: yPos(position),
width: widgetWidth,
height: widgetHeight
};
- dropdown.defaultUpdateAppearances(font);
+
const dropdownOption = getWidgetPosition(page, dropdownObj, 1);
- const dropdownSelected = { ...dropdownOption, font: font };
+ const dropdownSelected = {
+ ...dropdownOption,
+ font: font,
+ textColor: updateColorInRgb
+ };
+ dropdown.defaultUpdateAppearances(font);
dropdown.addToPage(page, dropdownSelected);
dropdown.enableReadOnly();
} else if (position.type === radioButtonWidget) {
const radioRandomId = "radio" + randomId();
const radioGroup = form.createRadioGroup(radioRandomId);
let radioOptionGapFromTop;
- const optionsFontSize = 16;
+ const optionsFontSize = parseInt(position?.options?.fontSize) || 16;
const radioTextGapFromLeft = 20;
const radioSize = 18;
let y = yPos(position);
@@ -1561,7 +1575,8 @@ export const multiSignEmbed = async (
optionsFontSize,
rgb(0, 0, 0),
font,
- page
+ page,
+ updateColorInRgb
);
page.drawText(item, optionsPosition);
@@ -1597,8 +1612,8 @@ export const multiSignEmbed = async (
});
}
const pdfBytes = await pdfDoc.saveAsBase64({ useObjectStreams: false });
- //console.log("pdf", pdfBytes);
- return pdfBytes;
+ console.log("pdf", pdfBytes);
+ //return pdfBytes;
};
// function for validating URLs
diff --git a/apps/OpenSign/src/pages/PlaceHolderSign.js b/apps/OpenSign/src/pages/PlaceHolderSign.js
index d3b544f27..a57b8dadf 100644
--- a/apps/OpenSign/src/pages/PlaceHolderSign.js
+++ b/apps/OpenSign/src/pages/PlaceHolderSign.js
@@ -1354,7 +1354,13 @@ function PlaceHolderSign() {
values: dropdownOptions,
isReadOnly: isReadOnly || false,
isHideLabel: isHideLabel || false,
- defaultValue: defaultValue
+ defaultValue: defaultValue,
+ fontSize:
+ fontSize || currWidgetsDetails?.options?.fontSize || "12",
+ fontColor:
+ fontColor ||
+ currWidgetsDetails?.options?.fontColor ||
+ "black"
}
};
}
@@ -1386,7 +1392,13 @@ function PlaceHolderSign() {
},
defaultValue: defaultValue,
isReadOnly: isReadOnly || false,
- isHideLabel: isHideLabel || false
+ isHideLabel: isHideLabel || false,
+ fontSize:
+ fontSize || currWidgetsDetails?.options?.fontSize || "12",
+ fontColor:
+ fontColor ||
+ currWidgetsDetails?.options?.fontColor ||
+ "black"
}
};
}
@@ -1398,7 +1410,13 @@ function PlaceHolderSign() {
name: dropdownName,
status: status,
values: dropdownOptions,
- defaultValue: defaultValue
+ defaultValue: defaultValue,
+ fontSize:
+ fontSize || currWidgetsDetails?.options?.fontSize || "12",
+ fontColor:
+ fontColor ||
+ currWidgetsDetails?.options?.fontColor ||
+ "black"
}
};
}
@@ -1425,6 +1443,8 @@ function PlaceHolderSign() {
}
}
}
+ setFontSize();
+ setFontColor();
};
const handleWidgetdefaultdata = (defaultdata) => {
const options = ["email", "number", "text"];
@@ -1934,6 +1954,10 @@ function PlaceHolderSign() {
setCurrWidgetsDetails={setCurrWidgetsDetails}
handleClose={handleNameModal}
isSubscribe={isSubscribe}
+ fontSize={fontSize}
+ setFontSize={setFontSize}
+ fontColor={fontColor}
+ setFontColor={setFontColor}
/>
{/* pdf header which contain funish back button */}
diff --git a/apps/OpenSign/src/pages/SignyourselfPdf.js b/apps/OpenSign/src/pages/SignyourselfPdf.js
index c5a39873d..588acadb7 100644
--- a/apps/OpenSign/src/pages/SignyourselfPdf.js
+++ b/apps/OpenSign/src/pages/SignyourselfPdf.js
@@ -1093,7 +1093,11 @@ function SignYourSelf() {
name: dropdownName,
values: dropdownOptions,
isReadOnly: isReadOnly,
- isHideLabel: isHideLabel || false
+ isHideLabel: isHideLabel || false,
+ fontSize:
+ fontSize || currWidgetsDetails?.options?.fontSize || "12",
+ fontColor:
+ fontColor || currWidgetsDetails?.options?.fontColor || "black"
}
};
}
@@ -1111,6 +1115,8 @@ function SignYourSelf() {
handleCloseModal();
}
}
+ setFontSize();
+ setFontColor();
};
const handleCloseModal = () => {
setCurrWidgetsDetails({});
@@ -1265,6 +1271,10 @@ function SignYourSelf() {
setCurrWidgetsDetails={setCurrWidgetsDetails}
isSignYourself={true}
handleClose={handleCloseModal}
+ fontSize={fontSize}
+ setFontSize={setFontSize}
+ fontColor={fontColor}
+ setFontColor={setFontColor}
/>
{
status: status,
defaultValue: defaultValue,
isReadOnly: isReadOnly || false,
- isHideLabel: isHideLabel || false
+ isHideLabel: isHideLabel || false,
+ fontSize:
+ fontSize || currWidgetsDetails?.options?.fontSize || "12",
+ fontColor:
+ fontColor ||
+ currWidgetsDetails?.options?.fontColor ||
+ "black"
}
};
}
@@ -1121,7 +1127,13 @@ const TemplatePlaceholder = () => {
},
isReadOnly: isReadOnly || false,
defaultValue: defaultValue,
- isHideLabel: isHideLabel || false
+ isHideLabel: isHideLabel || false,
+ fontSize:
+ fontSize || currWidgetsDetails?.options?.fontSize || "12",
+ fontColor:
+ fontColor ||
+ currWidgetsDetails?.options?.fontColor ||
+ "black"
}
};
}
@@ -1133,7 +1145,13 @@ const TemplatePlaceholder = () => {
name: dropdownName,
status: status,
values: dropdownOptions,
- defaultValue: defaultValue
+ defaultValue: defaultValue,
+ fontSize:
+ fontSize || currWidgetsDetails?.options?.fontSize || "12",
+ fontColor:
+ fontColor ||
+ currWidgetsDetails?.options?.fontColor ||
+ "black"
}
};
}
@@ -1160,6 +1178,8 @@ const TemplatePlaceholder = () => {
}
}
}
+ setFontSize();
+ setFontColor();
};
const handleWidgetdefaultdata = (defaultdata) => {
@@ -1391,6 +1411,10 @@ const TemplatePlaceholder = () => {
setCurrWidgetsDetails={setCurrWidgetsDetails}
handleClose={handleNameModal}
isSubscribe={isSubscribe}
+ fontSize={fontSize}
+ setFontSize={setFontSize}
+ fontColor={fontColor}
+ setFontColor={setFontColor}
/>
{
setCurrWidgetsDetails={setCurrWidgetsDetails}
handleClose={handleNameModal}
isSubscribe={isSubscribe}
+ fontSize={fontSize}
+ setFontSize={setFontSize}
+ fontColor={fontColor}
+ setFontColor={setFontColor}
/>
{
setCurrWidgetsDetails={setCurrWidgetsDetails}
handleClose={handleNameModal}
isSubscribe={isSubscribe}
+ fontSize={fontSize}
+ setFontSize={setFontSize}
+ fontColor={fontColor}
+ setFontColor={setFontColor}
/>