Function for generating pdf from url