Chrome 扩展程序 - PDF 文件的"File_get_contents",在标签页中打开



是可能的,得到一个pdf文件的内容,这是在谷歌浏览器打开。

我开始与chrome扩展,权限"activetabs"等…

阅读标签的HTML代码是工作的,但我需要直接的文件数据,

这是如何工作的?有人有过这样的经历吗?

现在我找到了一个解决方案:

Javascript:

//Read file
var xhr = new XMLHttpRequest();
xhr.open('GET', 'file:///C:/Scource_File.pdf', true);
xhr.responseType = 'blob';
xhr.send();

//Send file
var xhr = new XMLHttpRequest();
var fd = new FormData();
fd.append('server-method', 'upload');
fd.append('file', blob);
xhr.open('POST', 'http://www.example.com/get_file_via_post.php', false);
xhr.send(fd);

最新更新