generate pdf and send as attachment