Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

The technique to capture HTML into JPG file

1 view
Skip to first unread message

Bin Chen

unread,
Nov 22, 2009, 7:22:04 AM11/22/09
to
Hi,

What I want to implement is simple, I want to use a programmable
method to capture the HTML into JPG file, given the start and end x,y
coordinates. Like I capture www.news.com (100,200) - (200 - 400)
rectangular area into JPG file.

I think I need to use a HTML rendering library like WEBKIT? Or maybe I
can use an invisible window to let browser render it and then use
graphics API to save the result.

Any ideas? This program needs to support UNIX and Windows and
preferable windows platform.

Thanks.
Bin

Jens Thoms Toerring

unread,
Nov 22, 2009, 11:53:16 AM11/22/09
to
Bin Chen <binar...@gmail.com> wrote:
> What I want to implement is simple, I want to use a programmable
> method to capture the HTML into JPG file, given the start and end x,y
> coordinates. Like I capture www.news.com (100,200) - (200 - 400)
> rectangular area into JPG file.

Does the problem as stated really makes sense? Depending on
renderer being used plus all kinds of set-up values (the
window size for the page or e.g. default font sizes) the
rectangle could look completely different. There's no well-
defined relation between the HTML data and the way it looks
like - that's just the advantage of it, it can be rendered
in a way suitable for the display being used for output.

> I think I need to use a HTML rendering library like WEBKIT?
> Or maybe I can use an invisible window to let browser render
> it and then use graphics API to save the result.

You definitely would need something that does the rendering,
be it a HTML rendering library or a browser. Since I have no
idea how you could get a browser to draw into an unvisible
window I would guess your best bet would be the use of a ren-
dering library. That should also take care of problems of get-
ting the same settings each time and everywhere, not being de-
pendent on browser settings that probably are hard to control.

Regards, Jens
--
\ Jens Thoms Toerring ___ j...@toerring.de
\__________________________ http://toerring.de

Bin Chen

unread,
Nov 23, 2009, 3:27:17 AM11/23/09
to
On Nov 23, 12:53 am, j...@toerring.de (Jens Thoms Toerring) wrote:

> Bin Chen <binary.c...@gmail.com> wrote:
> > What I want to implement is simple, I want to use a programmable
> > method to capture the HTML into JPG file, given the start and end x,y
> > coordinates. Like I capturewww.news.com(100,200) - (200 - 400)

> > rectangular area into JPG file.
>
> Does the problem as stated really makes sense? Depending on
> renderer being used plus all kinds of set-up values (the
> window size for the page or e.g. default font sizes) the
> rectangle could look completely different. There's no well-
> defined relation between the HTML data and the way it looks
> like - that's just the advantage of it, it can be rendered
> in a way suitable for the display being used for output.
>
> > I think I need to use a HTML rendering library like WEBKIT?
> > Or maybe I can use an invisible window to let browser render
> > it and then use graphics API to save the result.
>
Thanks for your reply. Yes I know if the screen size is different the
result is not the same. My program doesn't need the strict output, you
can assume a big enough screen, I just want to get 80% result
acceptable but not all.

Bin

0 new messages