Adding a try except statement in html_pdf, html_txt and txt_html