Hi,
You can use below function to set size based of document content.
<script language="JavaScript">
function autoResize(id){
var newheight;
var newwidth;
if(document.getElementById){
newheight = document.getElementById(id).contentWindow.document .body.scrollHeight;
newwidth = document.getElementById(id).contentWindow.document .body.scrollWidth;
}
document.getElementById(id).height = (newheight) + "px";
document.getElementById(id).width = (newwidth) + "px";
}
</script>
I hope this will help you out.