Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

html to image

Thread view: 
qwer - 15 Apr 2006 00:16 GMT
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?
Oliver Wong - 15 Apr 2006 01:19 GMT
>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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.