简体   繁体   中英

Can I extract a formatted string from a PDF File name in JavaScript?

I have seen some questions regarding extracting information from a PDF file using JS.

I am wondering if there would be anyway to build a program where I can drag upload a file ( or group of files ) into a GUI and then convert the PDF file names into a table of strings... but formatted.

I have a bunch of PDF formatted like

“First.Last.Date”

My job requires me to go through a long list of PDF files, manually read the names within, and then search for them in a database, and if I could do this in a JavaScript program then my workflow time would be cut in half ( if not more ).

Sorry if this question lacks any code. I am not sure if this is worth perusing in JavaScript and not sure where to start with file uploads.

I'm not exactly clear on what you want to do with the file names once you've got them, but the following code will get you the file names.

 document.getElementById('myfiles').onchange = function (e) { var fileList = []; for (var i = 0; i < e.target.files.length; i++) { fileList.push(e.target.files[i].name); } console.log(fileList); };
 <label for="myfile">Select PDF file(s):</label> <input type="file" id="myfiles" name="myfiles" multiple>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM