Code to convert html into pdf - error