Hi,
I guess you are not using Portal Engine development model, right?
From my understanding, what you are trying to achiever can be easily achieved using a Universal document viewer or a repeater using portal engine development model.
Please share more about your development model approach.
Thanks,
Chetan