diff --git a/index.html b/index.html
index dc4c093..e456a2a 100644
--- a/index.html
+++ b/index.html
@@ -104,6 +104,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
Add PDF
Save Signed PDF
+
Close PDF
Settings
diff --git a/js/pdf.js b/js/pdf.js
index 1540ae5..b73b7b2 100644
--- a/js/pdf.js
+++ b/js/pdf.js
@@ -30,6 +30,16 @@ function addPDF() {
}, ".pdf");
}
+function closePDF(showuserconfirm) {
+ if (showuserconfirm && !confirm("Are you sure you want to close? All unsaved changes will be lost.")) {
+ return;
+ }
+ disableGuideBox();
+ pageNumber = 0;
+ pdfDoc = null;
+ $("#page-canvas-container .page-canvas").remove();
+}
+
function generatePDF() {
var canvases = $("#page-canvas-container .page-canvas");
const pdf = new jsPDF({
@@ -82,6 +92,7 @@ function makeAndSaveSignedPDF(pdf, savepath, callback) {
}
function savePDF() {
+ disableGuideBox();
loadKeyFromLocalStorage(function (message, ok) {
if (ok) {
openSaveFileDialog(function (path) {