How to generate pdf file from an html page??

abhishek guptaabhishek1983 at gmail.com
Wed Dec 19 01:03:46 EST 2007


On Dec 17, 8:42 pm, Grant Edwards <gra... at visi.com> wrote:
> On 2007-12-16, abhishek <guptaabhishek1... at gmail.com> wrote:
>
> > Hi everyone, I am trying to generate a PDF printable format file from
> > an html page. Is there a way to do this using python. If yes then
> > which library and functions are required and if no then reasons why it
> > cant be done.
>
> Here's one way:
>
> ------------------------------html2pdf.py-----------------------------------------
> #!/usr/bin/python
> import os,sys
>
> inputFilename,outputFilename = sys.argv[1:3]
>
> os.system("w3m -dump %s | a2ps -B --borders=no | ps2pdf - %s" % (inputFilename,outputFilename))
> ----------------------------------------------------------------------------------
>
> --
> Grant Edwards                   grante             Yow! Someone in DAYTON,
>                                   at               Ohio is selling USED
>                                visi.com            CARPETS to a SERBO-CROATIAN

hi grant have tried the command it resulted in the following errors
--

sh: a2ps: not found
ESP Ghostscript 815.04: **** Could not open the file /home/samba/users/
Abhishek/newTemplate.pdf .
**** Unable to open the initial device, quitting.
256



More information about the Python-list mailing list