Old Ruby based PDF generation logic