Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gethugothemes/dot-hugo-documentation-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to 'assets')
-rw-r--r--assets/js/script.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/assets/js/script.js b/assets/js/script.js
index e8e111e..b53232d 100644
--- a/assets/js/script.js
+++ b/assets/js/script.js
@@ -127,4 +127,23 @@
$(this).removeClass('active')
})
+
+ // Download page to pdf format
+ window.onload = function() {
+ document.getElementById("generatePDF")
+ .addEventListener("click", () => {
+ const content = this.document.getElementById("content");
+ console.log(content);
+ console.log(window);
+ var opt = {
+ margin: 1,
+ filename: document.querySelector('#title').innerHTML,
+ image: { type: 'jpeg', quality: 0.98 },
+ html2canvas: { scale: 2 },
+ jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
+ };
+ html2pdf().from(content).set(opt).save();
+ })
+ }
+
})(jQuery); \ No newline at end of file