3

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?

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I'm trying to do this client side without server side code. I know there are server side implementations out there
0

I doubt this is possible at this moment. Perhaps PDF.js by Mozilla can get you in the right direction:

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

and the github repo

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

1 Comment

Yes I tried using this but it renders html to browser and server is needed so I could not get the html elements in a file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.