Is there a way to convert a pdf file into html file using JavaScript or jquery? Can this be done on client side and run locally?
有没有办法使用JavaScript或jquery将pdf文件转换为html文件?这可以在客户端完成并在本地运行吗?
So far I have only found server side solutions like pdf2htmlEX
到目前为止,我只找到了像pdf2htmlEX这样的服务器端解决方案
Maybe there is library?
也许有图书馆?
2 个解决方案
#1
2
Only in nodejs I think. You can run
我认为只在nodejs中。你可以跑
npm install pdftohtmljs
Then in your server code:
然后在您的服务器代码中:
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);
});
Alternatively, use this software which is easy to use from the command line.
或者,使用易于从命令行使用的软件。
#2
0
I doubt this is possible at this moment. Perhaps PDF.js by Mozilla can get you in the right direction:
我怀疑这是可能的。也许Mozilla的PDF.js可以让你朝着正确的方向前进:
and the github repo
和github回购
#1
2
Only in nodejs I think. You can run
我认为只在nodejs中。你可以跑
npm install pdftohtmljs
Then in your server code:
然后在您的服务器代码中:
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);
});
Alternatively, use this software which is easy to use from the command line.
或者,使用易于从命令行使用的软件。
#2
0
I doubt this is possible at this moment. Perhaps PDF.js by Mozilla can get you in the right direction:
我怀疑这是可能的。也许Mozilla的PDF.js可以让你朝着正确的方向前进:
and the github repo
和github回购