Marthee commited on
Commit
484bb70
·
verified ·
1 Parent(s): d48af17

Update templates/proposed-GUI.html

Browse files
Files changed (1) hide show
  1. templates/proposed-GUI.html +16 -1
templates/proposed-GUI.html CHANGED
@@ -1252,6 +1252,20 @@ function downloadPdf(pdfname,downloadPDFName) {
1252
  .catch(error => console.error('Error fetching PDF:', error));
1253
  }
1254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1255
 
1256
  //___________________________________________________________________________________________________________
1257
  //___________________________________________________________________________________________________________
@@ -2297,7 +2311,8 @@ function ImgSide(imgdata, spreadsheetLink, pdfLink,pdfname) {
2297
  downloadPdfbutton.prepend(icon1); // Add icon before the text
2298
  downloadPdfbutton.onclick=function(){
2299
  downloadname='Measured_PDF_'+pdfname;
2300
- downloadPdf(pdfname,downloadname)
 
2301
  }
2302
  downloadPdfbutton.addEventListener('mouseover', function () {
2303
  downloadPdfbutton.style.boxShadow = '0 0 8px 2px rgb(47, 131, 198)';
 
1252
  .catch(error => console.error('Error fetching PDF:', error));
1253
  }
1254
 
1255
+ function downloadPDFfromLink(pdfLinksent, downloadPDFName) {
1256
+ const encodedURL = encodeURIComponent(pdfLinksent);
1257
+ fetch(`/downloadPDFfromLink?url=${encodedURL}`)
1258
+ .then(response => response.blob())
1259
+ .then(blob => {
1260
+ const url = URL.createObjectURL(blob);
1261
+ const link = document.createElement('a');
1262
+ link.href = url;
1263
+ link.download = downloadPDFName;
1264
+ link.dispatchEvent(new MouseEvent('click'));
1265
+ })
1266
+ .catch(error => console.error('Error fetching PDF:', error));
1267
+ }
1268
+
1269
 
1270
  //___________________________________________________________________________________________________________
1271
  //___________________________________________________________________________________________________________
 
2311
  downloadPdfbutton.prepend(icon1); // Add icon before the text
2312
  downloadPdfbutton.onclick=function(){
2313
  downloadname='Measured_PDF_'+pdfname;
2314
+ const encodedURL = encodeURIComponent(JSON.stringify(pdfLink))
2315
+ downloadPDFfromLink(pdfLink,downloadname)
2316
  }
2317
  downloadPdfbutton.addEventListener('mouseover', function () {
2318
  downloadPdfbutton.style.boxShadow = '0 0 8px 2px rgb(47, 131, 198)';