Before you ask for the height of the document inside the iframe you should set the height of the iframe object to “auto”. Something like this:
objIframe = document.getElementById('theIframeId');
objIframe.style.height="auto";
And now:
document.body.scrollHeight
returns the actual height of the document.