Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use PDF.js to statically convert a PDF to HTML

Tags:

PDF.js is the latest library from Mozilla, and is a standards-based PDF renderer that is written entirely in Javascript. Currently you cannot access the generated HTML, and the library can only be used as a viewer. Is it possible to use PDF.js to statically convert a PDF to its HTML equivalent? Considering it renders in a browser, it must be HTML+CSS, and the JS would be used only for navigation.

After converting it to HTML I plan to use our existing HTML workflow to import/index/consume the page as if it were an ordinary HTML webpage.

like image 329
Robin Rodricks Avatar asked May 28 '13 06:05

Robin Rodricks


People also ask

What is the best way to convert PDF to HTML?

The quickest way to convert your PDF is to open it in Acrobat. Go to the File menu, navigate down to Export To, and select HTML Web Page. Your PDF will automatically convert and open in your default web browser.

How do I convert a PDF to node js in HTML?

This script include's PDF specified by argument to viewer. js Webpack and start browser. const fs = require('fs'); const path = require('path'); const pdf = require('process'). argv[2]; const chp = require('child_process'); const datauri = require(path.


1 Answers

Note: this is for the original question, as well as for others who may be visiting this for related help, as was the case with me. ;)

Answer:
You may try: Poppler or pdf2htmlEX which is based on Poppler.

I'd recommend looking at the pdf2htmlEX documentation it also has as very good comparison table.

like image 167
Asad Malik Avatar answered Oct 03 '22 05:10

Asad Malik