Skip to content

Commit

Permalink
Merge pull request #708 from OpenSignLabs/raktima-opensignlabs-patch-2
Browse files Browse the repository at this point in the history
feat: implemented a solution allowing for the simultaneous signing of a document by multiple signers
  • Loading branch information
prafull-opensignlabs authored May 9, 2024
2 parents 30e6e4b + ac82209 commit d03515e
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions apps/OpenSign/src/pages/PdfRequestFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ function PdfRequestFiles() {
const [currWidgetsDetails, setCurrWidgetsDetails] = useState({});
const [isSubscriptionExpired, setIsSubscriptionExpired] = useState(false);
const [extUserId, setExtUserId] = useState("");
const [pdfArrayBuffer, setPdfArrayBuffer] = useState("");
const [isEmailVerified, setIsEmailVerified] = useState(true);
const [isVerifyModal, setIsVerifyModal] = useState(false);
const [otp, setOtp] = useState("");
Expand Down Expand Up @@ -225,16 +224,6 @@ function PdfRequestFiles() {
//getting document details
const documentData = await contractDocument(documentId);
if (documentData && documentData.length > 0) {
const url =
documentData[0] && (documentData[0]?.SignedUrl || documentData[0]?.URL);
//convert document url in array buffer format to use embed widgets in pdf using pdf-lib
const arrayBuffer = await convertPdfArrayBuffer(url);
if (arrayBuffer === "Error") {
setHandleError("Error: Something went wrong!");
} else {
setPdfArrayBuffer(arrayBuffer);
}

setExtUserId(documentData[0]?.ExtUserPtr?.objectId);
const isCompleted =
documentData[0].IsCompleted && documentData[0].IsCompleted;
Expand Down Expand Up @@ -642,9 +631,32 @@ function PdfRequestFiles() {
setWidgetsTour(true);
} else {
setIsUiLoading(true);

const pngUrl = checkUser[0].placeHolder;
let pdfArrBuffer;
//`contractDocument` function used to get updated SignedUrl
//resolved issue of sign document by multiple signers simultaneously
const documentData = await contractDocument(documentId);
if (documentData && documentData.length > 0) {
const url = documentData[0]?.SignedUrl || documentData[0]?.URL;
//convert document url in array buffer format to use embed widgets in pdf using pdf-lib
const arrayBuffer = await convertPdfArrayBuffer(url);
if (arrayBuffer === "Error") {
setHandleError("Error: invalid document!");
} else {
pdfArrBuffer = arrayBuffer;
}
} else if (
documentData === "Error: Something went wrong!" ||
(documentData.result && documentData.result.error)
) {
setHandleError("Error: Something went wrong!");
} else {
setHandleError("Document not Found!");
}

// Load a PDFDocument from the existing PDF bytes
const existingPdfBytes = pdfArrayBuffer;
const existingPdfBytes = pdfArrBuffer;
try {
const pdfDoc = await PDFDocument.load(existingPdfBytes);
const isSignYourSelfFlow = false;
Expand Down

0 comments on commit d03515e

Please sign in to comment.