I haven't had much luck doing this in the past, so I've used a workaround where I try to calculate how much space I'll need at the top of the document, and then produce a dynamic variable for the header-height and pass that in. Sucks, but it may work for you.