Improve the PDF generator script