简体   繁体   English

在客户端的JavaScript / jquery中将pdf文件转换为html文件?

[英]Convert pdf file to html file in JavaScript/jquery on client side?

Is there a way to convert a pdf file into html file using JavaScript or jquery? 有没有一种方法可以使用JavaScript或jquery将pdf文件转换为html文件? Can this be done on client side and run locally? 可以在客户端完成并在本地运行吗?

So far I have only found server side solutions like pdf2htmlEX 到目前为止,我仅发现服务器端解决方案,例如pdf2htmlEX

Maybe there is library? 也许有图书馆?

Only in nodejs I think. 我认为只有在nodejs中。 You can run 你可以跑

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. 或者,使用此软件该软件可从命令行轻松使用。

I doubt this is possible at this moment. 我怀疑这是否可能。 Perhaps PDF.js by Mozilla can get you in the right direction: Mozilla的PDF.js也许可以为您提供正确的方向:

https://mozilla.github.io/pdf.js/ https://mozilla.github.io/pdf.js/

and the github repo 和github回购

https://github.com/mozilla/pdf.js https://github.com/mozilla/pdf.js

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

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