11

I am working on a project in which I need to work on both HTML and PDF files. And this requires a lot of HTML to PDF and PDF to HTML conversions.

The requirements are:

  1. It must be free, and preferably, open-source
  2. It must be completely offline
  3. It must be stable, reliable and well reputed

Is there such a software, and if yes, please recommend it.

4

8 Answers 8

3

Look at the newest version of mudraw. It is a command line tool that is from the MuPDF family of tools.

mudraw -o out.html -F html in.pdf

Use the newest version, if possible. It has gained quite a few new and additional features (it can do more than just PDF->HTML conversion):

$ mudraw
   Usage: mudraw [options] file [pages]
   -p -  password

   -o -  output file name (%d for page number)
   -F -  output format (default inferred from output file name)
         raster: png, tga, pnm, pam, pbm, pwg, pcl
         vector: svg, pdf, trace
         text: txt, html, stext

   -s -  show extra information:
         m - show memory use
         t - show timings
         f - show page features
         5 - show md5 checksum of rendered image

   -R -  rotate clockwise (default: 0 degrees)
   -r -  resolution in dpi (default: 72)
   -w -  width (in pixels) (maximum width if -r is specified)
   -h -  height (in pixels) (maximum height if -r is specified)
   -f -  fit width and/or height exactly; ignore original aspect ratio
   -B -  maximum bandheight (pgm, ppm, pam, png output only)

   -W -  page width for EPUB layout
   -H -  page height for EPUB layout
   -S -  font size for EPUB layout

   -c -  colorspace (mono, gray, grayalpha, rgb, rgba, cmyk, cmykalpha)
   -G -  apply gamma correction
   -I    invert colors

   -A -  number of bits of antialiasing (0 to 8)
   -D    disable use of display list
   -i    ignore errors

   pages comma separated list of page numbers and ranges

Update (April 2016)

The calling convention of the tool has been changed. It is still part of the MuPDF family, but you run it like this now:

mutool draw
2

pdf2htmlEX accurately converts PDFs to HTML and retains the formatting. However, the generated HTML code is hard to read and parse programmatically. It is free, open source, and works offline on a variety of platforms.

https://github.com/coolwanglu/pdf2htmlEX

https://github.com/coolwanglu/pdf2htmlEX/wiki/Download

1

Some PDF to HTML Converter is the only free, offline PDF to HTML converter I was able to find. Hope this works for you!

1

The "Free PDF to HTML Converter" software (you can find it here: http://www.free-pdf-to-word.org/tutorials/freepdftohtmlconverter01_how_to_convert_pdf_to_html.html) is a pretty good one. I've used it to convert several PDFs to HTML files and so far I'm quite satisfied with the output. It maintains the layout of the PDF quite well and you can choose whether you'd like to store the images from the PDF in a separate folder or not.

P.S. The download link is somewhere on the right where it says "Required Resources".

1

I'll repeat some existing answers with extra comments:

  • mupdf: wins in simplicity if you are fine with occasional (cosmetically) lossy conversions
  • pdf2htmlEX: wins in terms of fidelity at the expense of larger HTML size and unreadable HTML markup (js-based); suitable for PDF files with complex graphics and custom fonts
  • pdftohtml: mentioning as an option that should probably be skipped as it does not support PDF version higher than v1.5 and produces a generally poor result; yet, it's available in most linux distros for example as part of the poppler-utils in ubuntu/debian and might still be suitable for certain use cases
  • google docs: not offline, not open-source, freeish, including for the sake of completeness: if you drop a PDF file into your google drive, right-click it ➔ Open withGoogle Docs then it will be converted to an editable document that can be saved from Google Docs via FileDownload to Web page (zipped) or MSWord formats
0

Calibre is a free open source program for Windows/Mac/Linux that is able to quickly convert PDF files to an HTMLZ archive. The HTMLZ archive contains an index.html file inside which is the converted .html file. It also contains a style.css file for the formatting and sometimes may contain an images folder that has images inside.

I was surprised at how good a job Calibre does at converting PDF books to .html when I tried it. It preserved the text formatting and didn't make any mistakes about preserving the line endings. When I tried Calibre on a magazine or on a text document that wasn't well formatted to begin with, the results were unacceptable unless the PDF file was converted to plain text and then manually edited in a word processor and saved as an .html file. This gives perfect results, but is very time-consuming. Calibre can't convert every PDF file well, but it does a good job most of the time so it is worth a try.

1
0

I know you said standalone - but if you can work with node - this is the best node module I found:

https://github.com/peterdemartini/html5-to-pdf

To make things easier - here's a node/webpack project I created to create my CV using HTML

https://github.com/dwjohnston/cv

0

Have you tried pdf2html in Linux? Both free and Free, works off line, has been packaged by many distros for a long time.

https://linux.die.net/man/1/pdftohtml

Your Answer

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