Fixed pdf generation