-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdf_handle.js
57 lines (52 loc) · 1.68 KB
/
pdf_handle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function uploadFile() {
var blobFile = $('#filePDF')[0].files[0];
var formData = new FormData();
formData.append("data", blobFile);
$.ajax({
url: "http://147.182.183.30:12345/pdffile",
type: "POST",
data: formData,
processData: false,
contentType: false,
success: function(response) {
resp = atob(response)
let blob = new Blob([response], { type: "*/*" });
let a = document.createElement('a');
a.href = window.URL.createObjectURL(blob);
a.download = "flashread.pptx";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.removeObjectURL(a.href);
},
error: function(jqXHR, textStatus, errorMessage) {
console.log(errorMessage);
}
});
}
function uploadUrl() {
var data = $('#urlPDF')[0].value;
var formData = new FormData();
formData.append("data", data);
$.ajax({
url: "http://147.182.183.30:12345/pdflink",
type: "POST",
data: formData,
processData: false,
contentType: false,
success: function(response) {
resp = atob(response)
let blob = new Blob([response], { type: "*/*" });
let a = document.createElement('a');
a.href = window.URL.createObjectURL(blob);
a.download = "flashread.pptx";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.removeObjectURL(a.href);
},
error: function(jqXHR, textStatus, errorMessage) {
console.log(errorMessage);
}
});
}