mozilla2ps
What is mozilla2ps?mozilla2ps is a quick and gross hack to convert html to postscript pages in an unattended manner.
I needed to convert a lot of html pages to postscript and wasn't really satisfied with html2ps, so I went ahead
and toyed around with xulrunner and friends.
In order to use mozilla2ps you need Xul Runner.
Make sure you have Xulrunner correctly installed.
xulrunner --install-app mozilla2ps-0.8.xulapp /tmp xulrunner /tmp/mozilla2ps/application.ini --pdf=true file:///tmp/foo.html /tmp/foo.pdf xulrunner /tmp/mozilla2ps/application.ini http://lwn.net /tmp/lwn.ps \ -margins 0.25 -papername Letter -bgcolors true -bgimages true
Obviously you can use a more definitive directory instead of /tmp. You can find a different install approach here. I use it with this chmtopdf.py script in order to convert .chm files to pdf using only free tools. Since version 0.4 the following parameters are supported:
- -papername XXX
- -bgcolors true or false
- -bgimages true or false
- -margins # (sets all margins)
- -marginTop #
- -marginBottom #
- -marginLeft #
- -marginRight #
- -landscape true or false
- -pdf true or false
mozilla2ps has at least the following bugs:
- Remove the setTimeOut workaround
- Needs to show a window (so to really do it the headless way, you'll need XvFb or something similar). This is really a xulrunner/gecko limit for now
TODO
- Better documentation
- Simpler install
- Use cairo's capabilities on trunk to print directly on pdf and skip any printers
Download
mozilla2ps-0.8.xulapp -
3d183b5147388ed11f99018946f0e9aa
13 Nov 2010:
- Added documentation workaround about font spacing problem
- Added xulrunner 1.9.1 support
mozilla2ps-0.7.xulapp -
dcff9187f441c445e45b220c6f27c69b
30 Nov 2008:
- Added native pdf support (-pdf option) - Thanks Eric Peers
- Added xulrunner 1.9 support
mozilla2ps-0.6.xulapp -
8c4c3b62195f3823e75dd172bca4259a
4 May 2007:
- Added orientation support (-landscape option)
mozilla2ps-0.5.xulapp -
c498da7dd3d9b95760a81fd4645bbea2
9 Apr 2007:
- Added fix to hide headers and footers from Mark Hunting
- Fixed bgImages parameter (reported by Mark Hunting)
mozilla2ps-0.4.xulapp -
31353a0bcef0687beac9fe1bd262deaf
14 Dec 2006:
- Paul Schilling added command line parameter support
mozilla2ps-0.3.xulapp -
0c06fcf46a072572959660ec70d9af7c
27 Jul 2006:
- Get it to work on Windows (check the README for more info)
mozilla2ps-0.2.xulapp -
160d84db7661df30a55f88cdcc2ee469
19 Mar 2006:
- Correctly wait for printing to finish..
mozilla2ps-0.1.xulapp -
fbd1f96a676778ddc33cd6802f6b6157
19 Mar 2006:
- First release