30

What good libraries are there, in any common language, for converting PDF to HTML?

Charles Stewart
  • 11,453
  • 4
  • 45
  • 84
user178644
  • 321
  • 1
  • 3
  • 4
  • Attempted to turn it into a programming question. And I see lots of questions going from HTML to PDF but not the reverse so probably worthwhile keeping it? – Cruachan Oct 28 '09 at 18:01
  • This is completely subjective. Please reword your question as to not be subjective and give a little info about what you are trying to do. – Russ Bradberry Oct 28 '09 at 18:05
  • 3
    I've de-subjectified the question and reworded it to what I think the OP is asking. It's a pity SO doesn't have a feature to remove close votes. – Ether Oct 28 '09 at 18:11
  • Good work, Ether. BTW, unknown - if you're just looking for a program (not a library), please see: http://stackoverflow.com/questions/1531699/pdf-to-html-convertor (which... should probably be migrated to SU now) – Shog9 Oct 28 '09 at 19:05

9 Answers9

5

PDFBox at apache has an html extraction capability. http://pdfbox.apache.org/

3

If you are working on a Windows box, I think Amyuni has a library for this as well. Their PDF Document Convertor is accessible as a DLL, can be used widely among the languages supported by Visual Studio, and can convert to RTF, TML, EXCEL, JPEG, and TIFF.

William Daniel
  • 679
  • 6
  • 14
2

In linux install pdftohtml - For batch convertion of all files in a folder use:

ls *.pdf | xargs -I{} pdftohtml {}

This will create html site with all references and images from original documents. Every page in a separate html file. Very useful to convert project documentation to search for files by phrase, using common system file search.

Zon
  • 16,036
  • 6
  • 82
  • 92
2

The pdftohtml program converts pdf to html and xml and preserves position information of the text which is helpful for scraping tables..

It seems to be based on the xpdf library and has a windows binary, too.

Karsten W.
  • 16,858
  • 11
  • 64
  • 99
2

You can use a module in Python called PDFMiner.

You can install it like this:

pip install pdfminer

Use this module as below:

pdf2txt.py -o output.html -t html file.pdf

Link to the module: https://pypi.org/project/pdfminer/

Code J
  • 921
  • 1
  • 11
  • 29
1

In Perl, you can use the SWISH::Filter plugin SWISH::Filters::Pdf2HTML. (It requires the xpdf package.)

For the reverse (HTML to PDF), see this question.

Community
  • 1
  • 1
Ether
  • 51,401
  • 13
  • 87
  • 157
1

http://www.lowagie.com/iText/ Opensource library for both Java and C#

AZ_
  • 36,879
  • 28
  • 155
  • 201
  • This is probably your best bet. Parse the PDF using the library and generate HTML from the data. – TJB Oct 30 '09 at 05:44
0

if you're looking for a way to convert PDF to HTML once or twice then I recommend Adobe Online Conversion

If it's an API you're after then http://www.pdfonline.com/ has an SDK that should suit your needs.

If it's a library you're after then please let us know which server-side language you prefer.

Russ Bradberry
  • 10,519
  • 17
  • 67
  • 85
0

Given the vagueness of the original question I'm going to go ahead and give a solution that will work with any language that can execute command-line apps. Although it can be a little bit tricky to get setup, OpenOffice can be run in headless mode on a server and, with the help of jodconverter, can convert any file format to any other file format (well, any format conversions that openoffice can handle, that is).

Here are a couple of links that help with the setup:

Karim
  • 17,947
  • 13
  • 58
  • 69