View Full Version : converting rendered HTML to pdf from terminal

03-30-2005, 01:47 AM
does any one know of a way to convert a rendered HTML page to pdf from the command line on mac OS X (10.3)?

I have tried google and a variety of other search engines but everything they come up with isnt what I am looking for.

I did install ghostscript for ps2pdf but have been unsucessful in converting a rendered html page to post script so that I can use ps2pdf.

any ideas?

03-31-2005, 08:18 PM
You might want to try to first convert the document to postScript using html2ps (http://user.it.uu.se/~jan/html2ps.html).

Then from the command line try something like:

$> html2ps myFile.html | ps2pdf myFile.pdf


$> html2ps myFile.html > test.ps; ps2pdf test.ps test.pdf; rm test.ps

03-31-2005, 11:16 PM
its funny you mention that, I just downloaded that this morning...
Technically, it works, but it looks really bad compared to what I can do with css. It doesn’t preserve backgrounds or fonts very well but the tables do come out the way i had them.

04-01-2005, 02:14 PM
Yeah, I think they had another one to handle CSS better called xhtml2ps. Might want to try that. Also, I was looking at the documentation, and it looks like if you have the CSS in an external stylesheet, it's generally ignored, whereas if you have the CSS in the <head></head> tags, it works better.