You are "facing problem in converting HTML code to image" because there is not such "conversion" in principle.
Each fixed HTML does not produce any fixed image (excluding some pathological cases). The result on HTML rendering depends on this HTML and also on the size of the browser window and other factors, such as video card properties and screen settings. If you found some code for doing such "conversion" (probably you mean
http://code.google.com/p/java-html2image/[
^]), it means that it takes HTML and use some additional assumptions or additional information. If you don't like how it works, take it source code, figure out how it works and modify according to your needs. It's quite unlikely that anyone else would volunteer to do such pretty weird thing for you.
Good luck,
—SA