Changed javascript for pdf genereation