improve genPDF functionality