Skip to content

Commit

Permalink
Merge pull request #1373 from OpenSignLabs/fix_sign
Browse files Browse the repository at this point in the history
fix: widgets get removed from doc when signers try to sign at a time
  • Loading branch information
raktima-opensignlabs authored Oct 22, 2024
2 parents 9189a60 + b97ad9c commit 91f031e
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions apps/OpenSign/src/pages/PdfRequestFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -891,9 +891,29 @@ function PdfRequestFiles(props) {
setIsUiLoading(true);
// `widgets` is Used to return widgets details with page number of current user
const widgets = checkUser?.[0]?.placeHolder;

let pdfArrBuffer;
//`contractDocument` function used to get updated SignedUrl
// to resolve issue of widgets get remove automatically when more than 1 signers try to sign doc at a time
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 91f031e

Please sign in to comment.