I want to read text in .docx .pdf File in JS environment.
but No exist Reading Text Example from input File Object.
Some Other question’s that Reading Text from File on path.
This is my code
// template
<v-file-input @change="uploadFile" />
// script
async uploadFile(file) {
if (file != null) {
// Extract file ext
this.test_file = file;
const ext = this.test_file.name.substring(this.test_file.name.lastIndexOf('.') + 1, this.test_file.name.length).toLowerCase();
// Process by ext
switch (ext) {
case 'txt':
let text = await this.test_file.text();
this.file_text = text;
break;
case 'docx':
// How can I process docx file
break;
case 'pdf':
// How can I process pdf file
break;
default:
break;
}
} else {
this.file_text = '';
}
}