Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I written one XSD schema, I documented that schema using xmlpad, It generates the HTML documentation automatically for that XSD schema. Now I want to generate a PDF document for that HTML document. I thought to convert the HTML document to LaTeX and I am using pdflatex to generate the PDF document. But I don't know how to convert a HTML document to LaTeX? Is there any open source tool? Can anyone suggest a tool or any other way? I need to convert a HTML document to PDF.

share|improve this question
1  
I don't think it is a good idea. Every browser's "print" button can convert HTML to PDF directly, without the need to go through latex. –  Federico Poloni Jan 27 '12 at 12:53
2  
Have a look at this question: tex.stackexchange.com/questions/3079/… –  Psirus Jan 27 '12 at 13:01
    
I used the open-source-project TCPDF several times already for directly converting HTML-code to PDF. I don't see any advantage in doing this with LaTex, to be honest. However, TCPDF requires a local PHP-installation or a webserver to run on. –  dhst Jan 27 '12 at 13:54

3 Answers 3

up vote 2 down vote accepted

I don't know about LaTeX, but with ConTeXt MkIV, you can parse XML. For an example of parsing HTML, see the My Way by Thomas Schmitz

share|improve this answer

Thanks to the solution from dfc! This is based on his suggestion.

You can directly use pandoc to convert HTML to PDF, e.g. convert google-cpp-styleguide.html to PDF documents:

pandoc cppguide.html -o cppguide.pdf

However, I prefer to firstly convert to LaTeX via pandoc, then edit .tex file to fit my desires (since the default PDF generated above is using article class in LaTeX, I prefer to tune the page layout to save papers). For example,

pandoc -s cppguide.html -o cppguide.tex

then use your favorite LaTeX (e.g. AucTeX) to edit it as you want, and pdflatex it.

Refer to http://pandoc.org/demos.html for pandoc usage demos.

share|improve this answer

You could use pandoc to convert the HTML to LaTeX and then generate the PDF from the output.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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