Adding pdf generation code