Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a HTML file that is using a style.css and has colors, ex.:

<font style=BACKGROUND-COLOR:red; color=white>FOO</font>

How can I "export" this local file on my Ubuntu 12.04 to a PDF? (the look and color should stay the same). I tried ex.: Ctrl+P -> print to PDF, but it didn't preserve the colours. I tried htmldoc with the --color option.. but it's the same problem..

It would be great to do this via the command line.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Open your html file in LibreOffice Writer and then, under File in the menu, choose export to PDF. That's it.

If you prefer the command line, take a look at Convert HTML Page To a PDF Using Open Source Tool - Linux / OS X / Windows.

The software can be installed using sudo apt-get install wkhtmltopdf.

share|improve this answer
    
I think this can be automated on the command line as well with some efforts. :) –  gertvdijk Jul 15 '13 at 7:08
    
@gertvdijk, That is beyond my competence. I've never used LibO via CLI. –  user25656 Jul 15 '13 at 7:14
    
There is this, wkhtmltopdf, as well but I have no experience of it: cyberciti.biz/open-source/… –  user25656 Jul 15 '13 at 7:16
    
Please post wkhtmltopdf as ANSWER, it resolved the problem –  gasko peter Jul 15 '13 at 7:28
    
@gaskopeter, done as requested by editing the answer. –  user25656 Jul 15 '13 at 7:36
add comment

Web2PDFConverter extension for Chromium or Chrome convert any webpage to PDF.

Or, you can just only use this site: http://pdfcrowd.com/. For local files: http://pdfcrowd.com/#convert_by_upload

share|improve this answer
    
using Firefox+cmd line would be better:P –  gasko peter Jul 15 '13 at 7:19
    
@gaskopeter pdfcrowd.com/#convert_by_upload - open it in Firefox –  Radu Rădeanu Jul 15 '13 at 7:21
add comment

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.