Support for PDF hot reload in PDF.js

This commit is contained in:
Benjamin Beganović 2021-09-20 17:33:45 +02:00
parent 2f3463d5d5
commit 712598b94c

View File

@ -80,6 +80,15 @@ class PDF {
.getElementById('zoom-out')
.addEventListener('click', () => this.handleZoomChange());
document
.querySelector('meta[name=pdf-url]')
.addEventListener('change', () => {
this.canvas.getContext('2d').clearRect(0, 0, this.canvas.width, this.canvas.height);
this.url = document.querySelector("meta[name='pdf-url']").content;
this.handle();
})
return this;
}