-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
110 lines (92 loc) · 3.35 KB
/
index.html
File metadata and controls
110 lines (92 loc) · 3.35 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PDF to Word Converter</title>
<!-- Bootstrap 5 CDN -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background: linear-gradient(to right, #4e73df, #1cc88a);
height: 100vh;
}
.card {
border-radius: 15px;
}
#downloadBtn {
display: none;
}
.progress {
height: 20px;
display: none;
}
</style>
</head>
<body class="d-flex align-items-center justify-content-center">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card shadow-lg p-4">
<h3 class="text-center mb-4">PDF to Word Converter</h3>
<div class="mb-3">
<label class="form-label">Upload PDF File</label>
<input class="form-control" type="file" id="pdfFile" accept=".pdf">
</div>
<div class="d-grid gap-2">
<button id="convertBtn" class="btn btn-success" onclick="convertFile()">
Convert to Word
</button>
<div class="progress mt-3" id="progressBar">
<div class="progress-bar progress-bar-striped progress-bar-animated"
role="progressbar"
style="width: 0%"
id="progressFill">
</div>
</div>
<button id="downloadBtn" class="btn btn-primary mt-3" onclick="downloadFile()">
Download Word File
</button>
</div>
<div id="status" class="text-center mt-3 fw-bold"></div>
</div>
</div>
</div>
</div>
<script>
function convertFile() {
let fileInput = document.getElementById("pdfFile");
let status = document.getElementById("status");
let progressBar = document.getElementById("progressBar");
let progressFill = document.getElementById("progressFill");
let downloadBtn = document.getElementById("downloadBtn");
if (fileInput.files.length === 0) {
alert("Please upload a PDF file.");
return;
}
progressBar.style.display = "block";
status.innerText = "Converting...";
let width = 0;
let interval = setInterval(function () {
if (width >= 100) {
clearInterval(interval);
status.innerText = "Conversion Successful!";
downloadBtn.style.display = "block";
} else {
width += 10;
progressFill.style.width = width + "%";
}
}, 200);
}
function downloadFile() {
const element = document.createElement("a");
const file = new Blob(["This is a dummy Word file for Selenium automation testing."],
{type: "application/msword"});
element.href = URL.createObjectURL(file);
element.download = "converted.doc";
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
</script>
</body>
</html>