.custom-upload-wrapper {
display: flex;
justify-content: center;
padding: 40px 15px;
}
.upload-container {
width: 100%;
/* max-width: 100%; */
background: rgb(28, 36, 75);
padding: 30px;
border-radius: 20px;
box-shadow: 0 0 20px rgba(254, 200, 12, 0.5);
text-align: center;
}
.custom-file-input {
display: none;
}
.custom-label {
display: inline-block;
background-color: rgb(254, 200, 12);
color: rgb(28, 36, 75);
font-weight: bold;
padding: 15px 25px;
border-radius: 12px;
cursor: pointer;
width: 100%;
text-align: center;
}
#downloadSection {
display: none;
margin-top: 20px;
}
#downloadBtn {
width: 100%;
padding: 12px 25px;
border: none;
border-radius: 10px;
background-color: rgb(254, 200, 12);
color: rgb(28, 36, 75);
font-weight: bold;
cursor: pointer;
}
PDF to CSV Converter
let extractedLines = [];
let csvBlobURL = null;
document.getElementById(“pdfUpload”).addEventListener(“change”, function (e) {
const file = e.target.files[0];
if (!file || file.type !== “application/pdf”) {
alert(“Please upload a valid PDF file.”);
return;
}
const reader = new FileReader();
reader.onload = function () {
const typedarray = new Uint8Array(this.result);
pdfjsLib.getDocument(typedarray).promise.then(async function (pdf) {
let fullText = ”;
for (let pageNum = 1; pageNum item.str);
fullText += strings.join(‘ ‘) + ‘n’;
}
extractedLines = fullText.split(‘n’).map(line => line.trim()).filter(line => line.length > 0);
const csvRows = [];
extractedLines.forEach(line => {
let cols = line.split(‘|’).map(col => col.trim());
if (cols.length {
progress += 1;
if (progress % 10 === 0) {
countdown–;
countdownText.textContent = countdown;
}
progressBar.style.width = progress + ‘%’;
if (progress >= 100) {
clearInterval(interval);
const a = document.createElement(‘a’);
a.href = csvBlobURL;
a.download = ‘bank_statement.csv’;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
setTimeout(() => {
countdownContainer.style.display = ‘none’;
progressBar.style.width = ‘0%’;
countdownText.textContent = ’10’;
}, 500);
}
}, 100); // total 10 seconds
});