【发布时间】:2016-05-25 15:32:58
【问题描述】:
有没有办法使用 JavaScript 或 jquery 将 pdf 文件转换为 html 文件?这可以在客户端完成并在本地运行吗?
到目前为止,我只找到了像 pdf2htmlEX 这样的服务器端解决方案
也许有图书馆?
【问题讨论】:
标签: javascript jquery html pdf
有没有办法使用 JavaScript 或 jquery 将 pdf 文件转换为 html 文件?这可以在客户端完成并在本地运行吗?
到目前为止,我只找到了像 pdf2htmlEX 这样的服务器端解决方案
也许有图书馆?
【问题讨论】:
标签: javascript jquery html pdf
我认为只有在 nodejs 中。你可以运行
npm install pdftohtmljs
然后在你的服务器代码中:
var pdftohtml = require('pdftohtmljs');
var converter = new pdftohtml('file.pdf', "file.html");
// see https://github.com/fagbokforlaget/pdftohtmljs/blob/master/lib/presets/ipad.js
converter.convert('ipad').then(function() {
console.log("converted");
}).catch(function(err) {
console.log(err);
});
或者,使用this software,它在命令行中很容易使用。
【讨论】:
我怀疑目前这是可能的。也许 Mozilla 的 PDF.js 可以让您朝着正确的方向前进:
还有 github 仓库
【讨论】: