[clug] Automating firefox

Michael Cohen scudette at gmail.com
Sun Jan 13 13:34:32 GMT 2008

Hello wise linux gurus.

I have a need in my web application to generate some pdfs from html
pages. I looked around the net and found lots of little scripts but
none produces anywhere near the quality that I need. I want to get a
near true replication o f the web page which means that it needs to
parse css properly, insert images etc. Unfortunately the users use
Internet exploder which is really crap for printing.

I looked on the net and this http://www.princexml.com/purchase/ looks
good but its prohibitively expensive (almost $5k - wow). Its output is
not too bad but not quite perfect still as it tried to create pdf
forms from html forms (so it doent look exactly like the web page).

I tried firefox and if you turn on the option file/page setup/print
background color and images it works very well and produces excellent
postscript which I can easily export to pdf. This is ideal but now i
have the problem of how do i automate this?

Ideally I would like to be able to call firefox from the command line
to print as a one off job (giving it a url as an arg). I dont think
its supported. Next I could try running it in a virtual X server and
programmatically clicking buttons on it - does anyone have any idea
how to do this? This is similar to GDI automation under windows - im
sure there is a way to do it under linux, i vaguely recall tridge
talking about it a while back in a clug meeting but I cant find any

Any help would be appreciated.


More information about the linux mailing list