Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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? Can this be done on client side and run locally?

So far I have only found server side solutions like pdf2htmlEX

Maybe there is library?

like image 286
0101 Avatar asked Jul 01 '26 07:07

0101


1 Answers

Only in nodejs I think. 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.

like image 50
Meelah Avatar answered Jul 02 '26 22:07

Meelah