aboutsummaryrefslogtreecommitdiffstats
path: root/sdv/pdf/site/scripts/createfile.js
diff options
context:
space:
mode:
authoropensource-tnbt <sridhar.rao@spirent.com>2020-09-10 12:23:34 +0530
committerSridhar Rao <sridhar.rao@spirent.com>2020-09-12 03:37:23 +0000
commit86d4114ab61f9cb00c1d01f91e81e9a38c6ba2f6 (patch)
tree5d5048528f9c5a15b372e9c889a276b5a3721de2 /sdv/pdf/site/scripts/createfile.js
parent27fff834bee372c53e1b5d222c398543ac3f34aa (diff)
SDV: Platform Description Implementation.
This patch includes PDF Template and a tool to create PDF. Signed-off-by: Sridhar K. N. Rao <sridhar.rao@spirent.com> Change-Id: Ib702ff42352d584cb9146ff1959258c558e06615
Diffstat (limited to 'sdv/pdf/site/scripts/createfile.js')
-rw-r--r--sdv/pdf/site/scripts/createfile.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/sdv/pdf/site/scripts/createfile.js b/sdv/pdf/site/scripts/createfile.js
new file mode 100644
index 0000000..2e13f2f
--- /dev/null
+++ b/sdv/pdf/site/scripts/createfile.js
@@ -0,0 +1,13 @@
+/**
+ * This function creates a Json file to support client-side file download
+ */
+
+function createjson() {
+ element=document.getElementById('pdfform')
+ data = objectifyDiv(element);
+ jsonstr = JSON.stringify(data);
+ var data = new Blob([jsonstr], {type: 'application/json'});
+ var url = window.URL.createObjectURL(data);
+ document.getElementById('download_link').href = url;
+ console.log(jsonstr);
+}