I simplified my code a bit and it works like the example. Now it renders everything correctly. The cause of my problem was that I was displaying the report as an image (Set peMode to C_IMAGEOUTPUT) and apparently showing it as HTML allows it to be resized properly.
Thank you very much!