fix the error in parsing html to generate pdf file