Hi All,
Request help on suggestions on the below.
I am creating a application for resume tracking. Applicants is my table consits of Blob colum to store resume PDF.
I created a JS function for single resume upload and extract Applicant_name,Mobile, email using regex.
I need help with multple resumes upload and extract ,store in table along with resume blob.
JS function for single:
function extractTextFromPDF(file, callback) {
const reader = new FileReader();
reader.onload = function () {
const typedarray = new Uint8Array(this.result);
pdfjsLib.getDocument(typedarray).promise.then(function (pdf) {
let textContent = '';
const loadPageText = pageNum => {
return pdf.getPage(pageNum).then(page => {
return page.getTextContent().then(content => {
const strings = content.items.map(item => item.str);
textContent += strings.join(' ') + '\\n';
});
});
};
const loadAllPages = async () => {
for (let i = 1; i <= pdf.numPages; i++) {
await loadPageText(i);
}
callback(textContent);
};
loadAllPages();
});
};
reader.readAsArrayBuffer(file);
}
function extractResumeFields(text, nameItem, emailItem, phoneItem) {
const name = text.match(/[A-Z][a-z]+\s[A-Z][a-z]+/);
const email = text.match(/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/);
const phone = text.match(/\+?\d{1,3}[-.\s]?\(?\d{1,4}\)?[-.\s]?\d{3}[-.\s]?\d{4}/);
if (name) $s(nameItem, name[0]);
if (email) $s(emailItem, email[0]);
if (phone) $s(phoneItem, phone[0]);
}
calling in file browser item
var fileInput = document.getElementById('P600_RESUME_ATTACHMENT');
var file = fileInput.files[0];
extractTextFromPDF(file, function (text) {
$s('P600_RESUME_TEXT', text);
extractResumeFields(text, 'P600_APPLICANT_NAME', 'P600_EMAIL_ADDRESS', 'P600_MOBILE_NUMBER');
});
Request your help for multiple resumes upload and extract,store. Any plugins or APIS or any way to do this is fine.