Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions apps/OpenSign/src/components/pdf/SignPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ function SignPad({
const fontfamily = fontStyle
? fontStyle
: fontSelect
? fontSelect
: "Fasthand";
? fontSelect
: "Fasthand";

//creating span for getting text content width
const span = document.createElement("span");
Expand Down Expand Up @@ -267,10 +267,10 @@ function SignPad({
key === 0 && penColor === "blue"
? "2px solid blue"
: key === 1 && penColor === "red"
? "2px solid red"
: key === 2 && penColor === "black"
? "2px solid black"
: "2px solid white"
? "2px solid red"
: key === 2 && penColor === "black"
? "2px solid black"
: "2px solid white"
}}
onClick={() => {
props?.convertToImg &&
Expand Down Expand Up @@ -536,7 +536,6 @@ function SignPad({
style={{
border: "1.3px solid #007bff",
borderRadius: "2px",

display: "flex",
flexDirection: "column",
justifyContent: "center",
Expand All @@ -553,7 +552,7 @@ function SignPad({
type="file"
onChange={onImageChange}
className="filetype"
accept="image/*"
accept="image/png,image/jpeg"
ref={imageRef}
hidden
/>
Expand Down
17 changes: 11 additions & 6 deletions apps/OpenSign/src/constant/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,17 +561,22 @@ export const signPdfFun = async (
isCustomCompletionMail = true;
}
}


// below for loop is used to get first signature of user to send if to signpdf
// for adding it in completion certificate
let getSignature;
for (let item of xyPosition) {
const typeExist = item.pos.some((data) => data?.type);
if (typeExist) {
getSignature = item.pos.filter((data) => data?.type === "signature");
getSignature = item.pos.find((data) => data?.type === "signature");
break;
} else {
getSignature = item.pos.filter((data) => !data.isStamp);
getSignature = item.pos.find((data) => !data.isStamp);
break;
}
}
let base64Sign = getSignature[0].SignUrl;

let base64Sign = getSignature.SignUrl;
//check https type signature (default signature exist) then convert in base64
const isUrl = base64Sign.includes("https");
if (isUrl) {
Expand Down Expand Up @@ -1344,8 +1349,8 @@ export const multiSignEmbed = async (
position.type === radioButtonWidget
? 10
: position.type === "checkbox"
? 10
: newUpdateHeight;
? 10
: newUpdateHeight;
const newHeight = ind ? (ind > 0 ? widgetHeight : 0) : widgetHeight;

if (signyourself) {
Expand Down
23 changes: 15 additions & 8 deletions apps/OpenSign/src/pages/PdfRequestFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,6 @@ function PdfRequestFiles() {
const existingPdfBytes = pdfArrayBuffer;
try {
const pdfDoc = await PDFDocument.load(existingPdfBytes);

const isSignYourSelfFlow = false;
const extUserPtr = pdfDetails[0].ExtUserPtr;
const HeaderDocId = extUserPtr?.HeaderDocId;
Expand Down Expand Up @@ -843,10 +842,18 @@ function PdfRequestFiles() {
}
} catch (err) {
setIsUiLoading(false);
setIsAlert({
isShow: true,
alertMessage: `Currently encrypted pdf files are not supported.`
});
if (err && err.message.includes("is encrypted.")) {
setIsAlert({
isShow: true,
alertMessage: `Currently encrypted pdf files are not supported.`
});
} else {
console.log("err in request signing", err);
setIsAlert({
isShow: true,
alertMessage: `Something went wrong.`
});
}
}
}
setIsSignPad(false);
Expand Down Expand Up @@ -1238,9 +1245,9 @@ function PdfRequestFiles() {
isDecline.currnt === "Sure"
? "Are you sure want to decline this document ?"
: isDecline.currnt === "YouDeclined"
? "You have declined this document!"
: isDecline.currnt === "another" &&
"You can not sign this document as it has been declined/revoked."
? "You have declined this document!"
: isDecline.currnt === "another" &&
"You can not sign this document as it has been declined/revoked."
}
footerMessage={isDecline.currnt === "Sure"}
declineDoc={declineDoc}
Expand Down
38 changes: 24 additions & 14 deletions apps/OpenSign/src/pages/SignyourselfPdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,13 +480,13 @@ function SignYourSelf() {
Width: widgetTypeExist
? calculateInitialWidthHeight(dragTypeValue, widgetValue).getWidth
: dragTypeValue === "initials"
? defaultWidthHeight(dragTypeValue).width
: "",
? defaultWidthHeight(dragTypeValue).width
: "",
Height: widgetTypeExist
? calculateInitialWidthHeight(dragTypeValue, widgetValue).getHeight
: dragTypeValue === "initials"
? defaultWidthHeight(dragTypeValue).height
: "",
? defaultWidthHeight(dragTypeValue).height
: "",
options: addWidgetOptions(dragTypeValue)
};

Expand Down Expand Up @@ -649,9 +649,7 @@ function SignYourSelf() {
const existingPdfBytes = pdfArrayBuffer;
// Load a PDFDocument from the existing PDF bytes
try {
const pdfDoc = await PDFDocument.load(existingPdfBytes, {
ignoreEncryption: true
});
const pdfDoc = await PDFDocument.load(existingPdfBytes);
const isSignYourSelfFlow = true;
const extUserPtr = pdfDetails[0].ExtUserPtr;
const HeaderDocId = extUserPtr?.HeaderDocId;
Expand All @@ -672,10 +670,18 @@ function SignYourSelf() {
await signPdfFun(pdfBytes, documentId);
} catch (err) {
setIsUiLoading(false);
setIsAlert({
isShow: true,
alertMessage: `Currently encrypted pdf files are not supported.`
});
if (err && err.message.includes("is encrypted.")) {
setIsAlert({
isShow: true,
alertMessage: `Currently encrypted pdf files are not supported.`
});
} else {
console.log("err in signing", err);
setIsAlert({
isShow: true,
alertMessage: `Something went wrong.`
});
}
}
}
} catch (err) {
Expand Down Expand Up @@ -703,16 +709,20 @@ function SignYourSelf() {
isCustomCompletionMail = true;
}
}
// below for loop is used to get first signature of user to send if to signpdf
// for adding it in completion certificate
let getSignature;
for (let item of xyPostion) {
const typeExist = item.pos.some((data) => data?.type);
if (typeExist) {
getSignature = item.pos.filter((data) => data?.type === "signature");
getSignature = item.pos.find((data) => data?.type === "signature");
break;
} else {
getSignature = item.pos.filter((data) => !data.isStamp);
getSignature = item.pos.find((data) => !data.isStamp);
break;
}
}
let base64Sign = getSignature[0].SignUrl;
let base64Sign = getSignature.SignUrl;
//check https type signature (default signature exist) then convert in base64
const isUrl = base64Sign.includes("https");
if (isUrl) {
Expand Down