Numerous changes to improve PDF report generation.