Corrected code to show image on pdf