From f92dee15901ae6e11115ce6df7c3c93b72a515d4 Mon Sep 17 00:00:00 2001 From: Kutaz Date: Mon, 9 Jan 2023 14:08:41 -0500 Subject: [PATCH] added save to pdf operation/cleanup --- src/web/waiters/OutputWaiter.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/web/waiters/OutputWaiter.mjs b/src/web/waiters/OutputWaiter.mjs index 1384684c..c8e2fb0d 100755 --- a/src/web/waiters/OutputWaiter.mjs +++ b/src/web/waiters/OutputWaiter.mjs @@ -508,6 +508,11 @@ class OutputWaiter { saveClick() { this.downloadFile(); } + + /** + * Handler for save to pdf events + * Saves the current output to a file. + */ savetopdf() { this.downloadPdf(); } @@ -539,12 +544,12 @@ class OutputWaiter { } const fileName = window.prompt("Please enter a filename: ", "download.pdf"); - // Assume if the user clicks cancel they don't want to download + //Assume if the user clicks cancel they don't want to download if (fileName === null) return; const data = await dish.get(Dish.HTML); //console.log(data, "this is our html") - var doc = new jsPDF('p', 'px', 'a4'); + const doc = new jsPDF('p', 'px', 'a4'); const width = doc.internal.pageSize.getWidth(); doc.html(data, {