9

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.

2

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

If you would like to use a commercial product, you should check out the LEADTOOLS SDK. You can simply convert your PDFs to HTML, and vice versa, files with just a couple lines of code. All you would need to do is load your PDF file using

// Load the source file (make sure to load as 24 bits/pixel)
RasterImage image = codecs.Load("PATH TO FILE", 24, CodecsLoadByteOrder.Bgr, 1, 1);

and then save that file as an HTML using

 // Save it as HTML
codecs.Save(image, "DESTINATION PATH", RasterImageFormat.Htm, 0);

Disclaimer: I am an employee of the product

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

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

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.