简体   繁体   English

我可以在 JavaScript 中从 PDF 文件名中提取格式化字符串吗?

[英]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.我看到了一些关于使用 JS 从 PDF 文件中提取信息的问题。

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.我想知道是否有办法构建一个程序,我可以将一个文件(或一组文件)拖动到一个 GUI 中,然后将 PDF 文件名转换为一个字符串表......但已格式化。

I have a bunch of PDF formatted like我有一堆 PDF 格式如下

“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 ).我的工作要求我浏览一长串 PDF 文件,手动读取其中的名称,然后在数据库中搜索它们,如果我可以在 JavaScript 程序中执行此操作,那么我的工作流程时间将减少一半(如果不多 )。

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.我不确定这是否值得在 JavaScript 中仔细阅读,也不确定从哪里开始上传文件。

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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