diff --git a/apps/OpenSign/src/components/pdf/PdfHeader.js b/apps/OpenSign/src/components/pdf/PdfHeader.js
index f006a8efc..896072f8e 100644
--- a/apps/OpenSign/src/components/pdf/PdfHeader.js
+++ b/apps/OpenSign/src/components/pdf/PdfHeader.js
@@ -7,6 +7,8 @@ import "../../styles/signature.css";
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
import { useNavigate } from "react-router-dom";
import { themeColor } from "../../constant/const";
+import Certificate from "./Certificate";
+import { PDFDownloadLink } from "@react-pdf/renderer";
function Header({
isPdfRequestFiles,
@@ -91,13 +93,64 @@ function Header({
};
//handle download signed pdf
- const handleDownloadCertificate = () => {
+ const handleDownloadCertificate = async () => {
if (pdfDetails?.length > 0 && pdfDetails[0]?.CertificateUrl) {
- const certificateUrl = pdfDetails[0] && pdfDetails[0]?.CertificateUrl;
- saveAs(certificateUrl, `Certificate_signed_by_OpenSign™.pdf`);
+ try {
+ await fetch(pdfDetails[0] && pdfDetails[0]?.CertificateUrl);
+ const certificateUrl = pdfDetails[0] && pdfDetails[0]?.CertificateUrl;
+ saveAs(certificateUrl, `Certificate_signed_by_OpenSign™.pdf`);
+ } catch (err) {
+ console.log("err in download in certificate", err);
+ }
}
};
+ const GenerateCertificate = () => {
+ //after generate download certifcate pdf
+ const handleDownload = (pdfBlob, fileName) => {
+ if (pdfBlob) {
+ const url = window.URL.createObjectURL(pdfBlob);
+ // Create a temporary anchor element
+ const link = document.createElement("a");
+ link.href = url;
+ link.download = fileName;
+ // Append the anchor to the body
+ document.body.appendChild(link);
+ // Programmatically click the anchor to trigger the download
+ link.click();
+ // Remove the anchor from the body
+ document.body.removeChild(link);
+ // Release the object URL to free up resources
+ window.URL.revokeObjectURL(url);
+ }
+ };
+
+ return (
+