This question has been raised hundred of times in various fora; some have been solved, some not. I checked plenty of resources, but my issue could not be resolved. I am gene
I came across this issue. You want to check all the variables you are using. One or even more than one variable you are passing comes empty and is messing the render.
Start gradually, by getting rid of all the php and try to generate the pdf, then if it works for you add code block by block.
This will help you identify where the problem is.