Its too tooo late but I found a solution but with a different angle...
You can generated PDF directly and display it in .
by doing this, you can also close rd object after use...