Render HTML?
William Park
opengeometry at yahoo.ca
Wed May 8 16:23:10 EDT 2002
On Wed, May 08, 2002 at 12:28:38AM -0700, Terry Hancock wrote:
> I have a need to render some HTML to an image format
> for a project I'm working on. I've tried html2ps combined
> with ImageMagick, and it might be good enough, but
> I do have some complaints:
>
> * html2ps is in Perl, which introduces a new language
> dependency (of course just about any web server will
> probably have Perl anyway).
>
> * It chokes on a lot of modern web pages, especially
> those with frames or javascript.
>
> It appears that one might be able to use Gecko (the
> rendering engine from Mozilla), but it's not clear to
> me how much work would be involved in interfacing it
> to my Python-based program, or whether any of this
> work has already been done.
>
> I can run html2ps using os.system() or popen() calls --
> a similar interface, or better yet, a Python API,
> would be nice.
>
> It's not too critical an application, so I might just
> stick to html2ps, if it's too hard to do something
> else. But it only works about 80% of the time, and
> sometimes it actually hangs (memory problems?).
>
> Any ideas, pet projects, etc?
> Cheers,
> Terry
If what Netscape displays is good enough, you can save it to PS directly.
netscape &
netscape -remote "openURL(http://www.babes.com) -remote "saveAs(babes.ps, Postscript)"
You still need to crop it using ImageMagick or something.
--
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
8-CPU Cluster, Hosting, NAS, Linux, LaTeX, python, vim, mutt, tin
More information about the Python-list
mailing list