Skip to content

🔥 The free & Open Source DocuSign alternative

fix: widgets get removed from doc when signers try to sign at a time

prafull-opensignlabsed840f304810
diff --git a/apps/OpenSign/src/pages/PdfRequestFiles.js b/apps/OpenSign/src/pages/PdfRequestFiles.js
index 3bf9596d0..6d9d98211 100644
--- a/apps/OpenSign/src/pages/PdfRequestFiles.js
+++ b/apps/OpenSign/src/pages/PdfRequestFiles.js
@@ -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;