script to generate pdf