I’ve been searching for this for some time, but I couldn’t seem to find a way to achieve this.
What I want to do is that I need the functionality of web page to pdf conversion from firefox. Right now the web page is generated in my django application and I use an open source software called “pisa”(or “xhtml2pdf”) to get pdf report. However, it only supports very limited css styles, and some of the images are not rendering properly. After trying several possibilities, I found that firefox gives exactly what I want though printing web page to pdf file option in the brower gui, so I’m wondering if I could use python or command line to make firefox does the same thing. I would be very appreciated if somebody can pointing me to some resources for firefox commands or python api. Thanks.
To print from the command line with Firefox, you need to install an extension. One such extension is
Command Line Print by torisugari.
This extension allows you to print URLs immediately, without user interaction. This can be useful to convert html pages to PDF for example.
You first have to install the extension from http://torisugari.googlepages.com/commandlineprint2
After you’ve properly installed the extension, you can start using Firefox as command line printer.
Usage:
from here Command Line Print – torisugari -> https://sites.google.com/site/torisugari/commandlineprint2
now you must add your page like 127.0.0.1/yourpage with django webserver
so with loop and address you can print all page