working pdf generation