PHASE 2: Added PDF generation.