I want convert html page to iamge (jpeg). I could use JEditorPane, but I
have to set it size (width and height) and I don't know what page's
dimension is. Do you know any solution of this problem?
>I want convert html page to iamge (jpeg). I could use JEditorPane, but I
>have to set it size (width and height) and I don't know what page's
>dimension is. Do you know any solution of this problem?
Sometimes an HTML document doesn't define its size at all, so any size
you choose is just as legitimate as any other. Look around to see if CSS
provides a hint (e.g. HTML { width: 640px; } ), otherwise choose an an
arbitrary width (perhaps 800px or 1024px would be good?), and set the height
to the closest approximation to "infinity" that you can manage, to get rid
of the scroll bar.
Then you got to write some AI to detect where the end of the page is,
and truncate all the stuff below it. Perhaps you can add some visible
signature (an image, text, an <hr/> element) at the bottom of the HTML
document, and when the AI sees this signature in the screenshot, it knows to
cut the image there.
- Oliver
andrewthommo@gmail.com - 19 Apr 2006 01:14 GMT
> >I want convert html page to iamge (jpeg).
Why?
>>..I could use JEditorPane,
Only for a very limited sub-set of the pages on the net.
JEP's are not robust enough for most HTML on the internet,
and don't support Applets, Flash or JS..
>>but I
> >have to set it size (width and height) and I don't know what page's
> >dimension is. Do you know any solution of this problem?
>
> Sometimes an HTML document doesn't define its size at all, ...
Sometimes? Any HTML document that does define a size, is
moderately to severely broken.
Andrew T.
Oliver Wong - 19 Apr 2006 15:37 GMT
>> Sometimes an HTML document doesn't define its size at all, ...
>
> Sometimes? Any HTML document that does define a size, is
> moderately to severely broken.
Admittedly, I'm not as familiar with CSS as I am with HTML, but I
noticed sometimes the only way I could get my page to "look right" was to
do:
html {
width: 800px;
}
- Oliver