Added PDF generation logic