mirror of
https://github.com/24eme/signaturepdf
synced 2026-03-14 13:55:44 +01:00
signature: form sent via javascript for storing response in cache
This commit is contained in:
parent
d30798a440
commit
dd25d3ec7d
1 changed files with 14 additions and 1 deletions
|
|
@ -897,7 +897,9 @@ function createEventsListener() {
|
|||
}
|
||||
|
||||
if(document.getElementById('save')) {
|
||||
document.getElementById('save').addEventListener('click', function(event) {
|
||||
document.getElementById('save').addEventListener('click', async function(event) {
|
||||
event.preventDefault()
|
||||
|
||||
let previousScale = currentScale;
|
||||
if(currentScale != defaultScale) {
|
||||
resizePDF(defaultScale)
|
||||
|
|
@ -915,6 +917,17 @@ function createEventsListener() {
|
|||
resizeTimeout = setTimeout(resizePDF(previousScale), 100);
|
||||
}
|
||||
|
||||
const formData = new FormData(this.form)
|
||||
const response = await fetch(this.form.action, {
|
||||
method: "POST",
|
||||
body: formData
|
||||
})
|
||||
|
||||
const blob = await response.blob()
|
||||
const filename = response.headers.get('Content-Disposition').split('"')[1]
|
||||
download(blob, filename)
|
||||
storeFileInCache(blob, formData.get('pdf').name)
|
||||
|
||||
hasModifications = false;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue